From d5a7cf27b851f81ba97b0253478229a36bb449f0 Mon Sep 17 00:00:00 2001 From: Shaheem Niyaz Date: Sat, 8 Aug 2026 23:36:19 +0530 Subject: [PATCH] feat: add api aggregations --- .gitignore | 2 ++ devfolio.py | 50 +++++++++++++++++++++++++++++++++++++++++++++ devnovate.py | 46 +++++++++++++++++++++++++++++++++++++++++ hack2skill.py | 28 +++++++++++++++++++++++++ hackculture.py | 44 ++++++++++++++++++++++++++++++++++++++++ requirements.txt | 5 +++++ reskilll.py | 53 ++++++++++++++++++++++++++++++++++++++++++++++++ unstop.py | 47 ++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 275 insertions(+) create mode 100644 devfolio.py create mode 100644 devnovate.py create mode 100644 hack2skill.py create mode 100644 hackculture.py create mode 100644 requirements.txt create mode 100644 reskilll.py create mode 100644 unstop.py diff --git a/.gitignore b/.gitignore index 36b13f1..2d92802 100644 --- a/.gitignore +++ b/.gitignore @@ -174,3 +174,5 @@ cython_debug/ # PyPI configuration file .pypirc +# JSON dumps +*.json diff --git a/devfolio.py b/devfolio.py new file mode 100644 index 0000000..f939d63 --- /dev/null +++ b/devfolio.py @@ -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() diff --git a/devnovate.py b/devnovate.py new file mode 100644 index 0000000..2d18730 --- /dev/null +++ b/devnovate.py @@ -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() diff --git a/hack2skill.py b/hack2skill.py new file mode 100644 index 0000000..ed91cb8 --- /dev/null +++ b/hack2skill.py @@ -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() diff --git a/hackculture.py b/hackculture.py new file mode 100644 index 0000000..3398c13 --- /dev/null +++ b/hackculture.py @@ -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() diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..2d3e31e --- /dev/null +++ b/requirements.txt @@ -0,0 +1,5 @@ +certifi==2026.7.22 +charset-normalizer==3.4.9 +idna==3.18 +requests==2.34.2 +urllib3==2.7.0 diff --git a/reskilll.py b/reskilll.py new file mode 100644 index 0000000..fb67e1e --- /dev/null +++ b/reskilll.py @@ -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() diff --git a/unstop.py b/unstop.py new file mode 100644 index 0000000..9f41bd2 --- /dev/null +++ b/unstop.py @@ -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()