Menu

1 / 2

Automate Hacker News Job Tracking with Python Script

DEV Community·IntelliTools·6 months ago
#JiyyFSyW
#python#automation#tutorial#productivity#jobs
Reading 0:00
15s threshold

import requests from bs4 import BeautifulSoup import csv

# Function to fetch Hacker News job postings def fetch_hn_jobs (): url = ' https://news.ycombinator.com/jobs ' response = requests . get ( url ) soup = BeautifulSoup ( response . text , ' html.parser ' ) jobs = []

# Extract job entries for item in soup . select ( ' .athing ' ): # Select job posts title = item . select_one ( ' .titlelink ' ). text link = item . select_one ( ' .titlelink ' )[ ' href ' ] company = item . select_one ( ' .subtext .company ' ). text . strip () role = item . select_one ( ' .subtext .role ' ). text . strip () location = item . select_one ( ' .subtext .location ' ). text . strip () jobs . append ({ ' company ' : company , ' role ' : role , ' location ' : location , ' link ' : link })

return jobs

Enter fullscreen mode

Exit fullscreen mode

The fetch_hn_jobs function above demonstrates how to programmatically extract job postings from Hacker News.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.