Skip to content

Instantly share code, notes, and snippets.

@hughdbrown
Created February 25, 2025 06:35
Show Gist options
  • Save hughdbrown/f41f5f3c072067c2351460d8d3a739d0 to your computer and use it in GitHub Desktop.
Save hughdbrown/f41f5f3c072067c2351460d8d3a739d0 to your computer and use it in GitHub Desktop.
Check how many of the job entries on Who Is Hiring? pages are actually 'trust', not 'rust'.
>>> import requests
>>> IDS = {
42919502: "2025-02-01",
42575537: "2025-01-01",
42297424: "2024-12-01",
42017580: "2024-11-01",
41709301: "2024-10-01",
41425910: "2024-09-01",
41129813: "2024-08-01",
40846428: "2024-07-01",
40563283: "2024-06-01",
40224213: "2024-05-01",
39894820: "2024-04-01",
39562986: "2024-03-01",
39217310: "2024-02-01",
38842977: "2024-01-01",
}
>>> for page_id, date in IDS.items():
url = f"https://hn.algolia.com/api/v1/items/{page_id}"
resp = requests.get(url, headers={'Accept': 'application/json'})
data = resp.json()
rust = sum('rust' in child['text'].lower() for child in data['children'])
trust = sum('trust' in child['text'].lower() for child in data['children'])
print(f"{'-' * 20} {date}: {rust = } {trust = }")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment