feat: add api aggregations
This commit is contained in:
@@ -174,3 +174,5 @@ cython_debug/
|
||||
# PyPI configuration file
|
||||
.pypirc
|
||||
|
||||
# JSON dumps
|
||||
*.json
|
||||
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
# import requests
|
||||
from datetime import datetime
|
||||
import json
|
||||
|
||||
# response = requests.post(
|
||||
# "https://api.devfolio.co/api/search/hackathons",
|
||||
# headers={
|
||||
# "User-Agent": (
|
||||
# "Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
|
||||
# "AppleWebKit/537.36 (KHTML, like Gecko) "
|
||||
# "Chrome/151.0.0.0 Safari/537.36"
|
||||
# ),
|
||||
# "Origin": "https://devfolio.co",
|
||||
# "Referer": "https://devfolio.co/",
|
||||
# },
|
||||
# json={
|
||||
# "type": "application_open",
|
||||
# "from": 0,
|
||||
# "size": 100,
|
||||
# },
|
||||
# )
|
||||
#
|
||||
# hackathons = list(map(lambda v: v["_source"], response.json()["hits"]["hits"]))
|
||||
|
||||
# with open("devfolio.json", "w", encoding="utf-8") as file:
|
||||
# file.write(response.text)
|
||||
|
||||
with open("devfolio.json") as file:
|
||||
hackathons = list(
|
||||
map(lambda v: v["_source"], json.loads(file.read())["hits"]["hits"])
|
||||
)
|
||||
|
||||
# print(hackathons[0])
|
||||
|
||||
for hackathon in hackathons:
|
||||
name = hackathon["name"]
|
||||
location = hackathon["location"]
|
||||
event_date = datetime.fromisoformat(hackathon["starts_at"]).date()
|
||||
reg_start = datetime.fromisoformat(
|
||||
hackathon["hackathon_setting"]["reg_starts_at"]
|
||||
).date()
|
||||
reg_end = datetime.fromisoformat(
|
||||
hackathon["hackathon_setting"]["reg_ends_at"]
|
||||
).date()
|
||||
|
||||
print(name)
|
||||
print(f"Location: {location}")
|
||||
print(f"Event Date: {event_date}")
|
||||
print(f"Registration: {reg_start} - {reg_end}")
|
||||
print()
|
||||
@@ -0,0 +1,46 @@
|
||||
# import requests
|
||||
from datetime import datetime
|
||||
import json
|
||||
|
||||
# response = requests.get(
|
||||
# "https://devnovate.co/api/v1/events",
|
||||
# headers={
|
||||
# "User-Agent": (
|
||||
# "Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
|
||||
# "AppleWebKit/537.36 (KHTML, like Gecko) "
|
||||
# "Chrome/151.0.0.0 Safari/537.36"
|
||||
# ),
|
||||
# },
|
||||
# )
|
||||
#
|
||||
# with open("devnovate.json", "w", encoding="utf-8") as file:
|
||||
# file.write(response.text)
|
||||
|
||||
with open("devnovate.json") as file:
|
||||
hackathons = json.loads(file.read())
|
||||
|
||||
for hackathon in hackathons:
|
||||
if (
|
||||
hackathon["registrationStatus"] != "OPEN"
|
||||
or hackathon["name"] == "test"
|
||||
or (
|
||||
hackathon["eventType"] != "hackathon"
|
||||
and "hackathon" not in hackathon["name"]
|
||||
and "hackathon" not in hackathon["subtitle"]
|
||||
)
|
||||
):
|
||||
continue
|
||||
|
||||
name = hackathon["name"]
|
||||
location = hackathon["location"]
|
||||
event_date = hackathon["startDate"]
|
||||
reg_end = datetime.fromisoformat(hackathon["registrationDeadline"])
|
||||
|
||||
if reg_end.timestamp() < datetime.now().timestamp():
|
||||
continue
|
||||
|
||||
print(name)
|
||||
print(f"Location: {location}")
|
||||
print(f"Event Date: {event_date}")
|
||||
print(f"Registration End: {reg_end.date()}")
|
||||
print()
|
||||
@@ -0,0 +1,28 @@
|
||||
# import requests
|
||||
from datetime import datetime
|
||||
import json
|
||||
|
||||
# response = requests.get(
|
||||
# "https://hack2skill.com/api/v1/innovator/public/event/public-list?page=1&records=27&isRegistrationOngoing=true",
|
||||
# headers={
|
||||
# "User-Agent": (
|
||||
# "Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
|
||||
# "AppleWebKit/537.36 (KHTML, like Gecko) "
|
||||
# "Chrome/151.0.0.0 Safari/537.36"
|
||||
# ),
|
||||
# },
|
||||
# )
|
||||
#
|
||||
# with open("hack2skill.json", "w", encoding="utf-8") as file:
|
||||
# file.write(response.text)
|
||||
|
||||
with open("hack2skill.json") as file:
|
||||
hackathons = json.loads(file.read())["data"]
|
||||
|
||||
for hackathon in hackathons:
|
||||
name = hackathon["title"]
|
||||
reg_end = datetime.fromisoformat(hackathon["registrationEnd"]).date()
|
||||
|
||||
print(name)
|
||||
print(f"Registration End: {reg_end}")
|
||||
print()
|
||||
@@ -0,0 +1,44 @@
|
||||
# import requests
|
||||
from datetime import datetime
|
||||
import json
|
||||
|
||||
# response = requests.get(
|
||||
# "https://api.hackculture.io/api/v1/hackathons?limit=50&response_type=card&sort_by=start_datetime&sort_order=-1",
|
||||
# headers={
|
||||
# "User-Agent": (
|
||||
# "Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
|
||||
# "AppleWebKit/537.36 (KHTML, like Gecko) "
|
||||
# "Chrome/151.0.0.0 Safari/537.36"
|
||||
# ),
|
||||
# "Origin": "https://hackculture.io",
|
||||
# "Referer": "https://hackculture.io/",
|
||||
# },
|
||||
# )
|
||||
#
|
||||
# with open("hackculture.json", "w", encoding="utf-8") as file:
|
||||
# file.write(response.text)
|
||||
|
||||
with open("hackculture.json") as file:
|
||||
hackathons = json.loads(file.read())
|
||||
|
||||
|
||||
# print(hackathons[0])
|
||||
|
||||
for hackathon in hackathons:
|
||||
if not hackathon["is_registration_open"] or hackathon["type"] != "hackathon":
|
||||
continue
|
||||
|
||||
name = hackathon["name"]
|
||||
org = hackathon["organizer_name"]
|
||||
location = None
|
||||
if hackathon["location"]:
|
||||
location = hackathon["location"]["name"]
|
||||
if hackathon["location"]["address"]:
|
||||
location += ", " + hackathon["location"]["address"]
|
||||
event_date = datetime.fromisoformat(hackathon["end_datetime"])
|
||||
|
||||
print(name)
|
||||
print(f"Organizer: {org}")
|
||||
print(f"Location: {location}")
|
||||
print(f"Event Date: {event_date.date()}")
|
||||
print()
|
||||
@@ -0,0 +1,5 @@
|
||||
certifi==2026.7.22
|
||||
charset-normalizer==3.4.9
|
||||
idna==3.18
|
||||
requests==2.34.2
|
||||
urllib3==2.7.0
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
# import requests
|
||||
from datetime import datetime
|
||||
import json
|
||||
# import re
|
||||
|
||||
# response = requests.get(
|
||||
# "https://reskilll.com/discover",
|
||||
# headers={
|
||||
# "User-Agent": (
|
||||
# "Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
|
||||
# "AppleWebKit/537.36 (KHTML, like Gecko) "
|
||||
# "Chrome/151.0.0.0 Safari/537.36"
|
||||
# ),
|
||||
# },
|
||||
# )
|
||||
#
|
||||
#
|
||||
# def strip_undefined(obj):
|
||||
# if isinstance(obj, dict):
|
||||
# return {k: strip_undefined(v) for k, v in obj.items() if v != "$undefined"}
|
||||
# elif isinstance(obj, list):
|
||||
# return [strip_undefined(element) for element in obj]
|
||||
# return obj
|
||||
#
|
||||
#
|
||||
# def extract_data(html):
|
||||
# match = re.search(r'\\"initialData\\":(\[.*?\])\}\]\]', html, re.DOTALL)
|
||||
# if match:
|
||||
# return strip_undefined(
|
||||
# json.loads(bytes(match.group(1), "utf-8").decode("unicode_escape"))
|
||||
# )
|
||||
# return None
|
||||
#
|
||||
# with open("reskilll.json", "w", encoding="utf-8") as file:
|
||||
# file.write(json.dumps(extract_data(response.text)))
|
||||
|
||||
with open("reskilll.json") as file:
|
||||
hackathons = json.loads(file.read())
|
||||
|
||||
for hackathon in hackathons:
|
||||
name = hackathon["title"]
|
||||
org = hackathon["organizer"]
|
||||
location = hackathon["location"]
|
||||
reg_end = datetime.strptime(hackathon["deadline"], "%b %d, %Y")
|
||||
|
||||
if reg_end.timestamp() < datetime.now().timestamp():
|
||||
continue
|
||||
|
||||
print(name)
|
||||
print(f"Organizer: {org}")
|
||||
print(f"Location: {location}")
|
||||
print(f"Registration End: {reg_end.date()}")
|
||||
print()
|
||||
@@ -0,0 +1,47 @@
|
||||
# import requests
|
||||
from datetime import datetime
|
||||
import json
|
||||
|
||||
# BASE_URL = "https://unstop.com/api/public/opportunity/search-result"
|
||||
# PARAMS = {
|
||||
# "opportunity": "hackathons",
|
||||
# "oppstatus": "open",
|
||||
# "per_page": "200",
|
||||
# }
|
||||
# HEADERS = {
|
||||
# "User-Agent": (
|
||||
# "Mozilla/5.0 (X11; Linux x86_64) "
|
||||
# "AppleWebKit/537.36 (KHTML, like Gecko) "
|
||||
# "Chrome/151.0.0.0 Safari/537.36"
|
||||
# )
|
||||
# }
|
||||
#
|
||||
# request_url = BASE_URL + "?" + "&".join(f"{k}={v}" for k, v in PARAMS.items())
|
||||
# response = requests.get(request_url, headers=HEADERS)
|
||||
#
|
||||
# with open("unstop.json", "w", encoding="utf-8") as file:
|
||||
# file.write(response.text)
|
||||
#
|
||||
# hackathons = response.json()["data"]["data"]
|
||||
|
||||
with open("unstop.json") as file:
|
||||
hackathons = json.loads(file.read())["data"]["data"]
|
||||
|
||||
for hackathon in hackathons:
|
||||
title = hackathon["title"]
|
||||
org = hackathon["organisation"]["name"]
|
||||
location = hackathon["address_with_country_logo"]["address"]
|
||||
event_date = datetime.fromisoformat(hackathon["end_date"]).date()
|
||||
reg_start = datetime.fromisoformat(
|
||||
hackathon["regnRequirements"]["start_regn_dt"]
|
||||
).date()
|
||||
reg_end = datetime.fromisoformat(
|
||||
hackathon["regnRequirements"]["end_regn_dt"]
|
||||
).date()
|
||||
|
||||
print(title)
|
||||
print(f"Organization: {org}")
|
||||
print(f"Location: {location}")
|
||||
print(f"Event Date: {event_date}")
|
||||
print(f"Registration: {reg_start} - {reg_end}")
|
||||
print()
|
||||
Reference in New Issue
Block a user