import requests
from bs4 import BeautifulSoup
import csv
url = 'https://news.ycombinator.com/jobs'
response = requests.get(url)
soup = BeautifulSoup(response.text, 'html.parser')
job_listings = soup.find_all('tr', class_='athing')
jobs = []
for job in job_listings:
title = job.find('span', class_='titlelink').text.strip()
company = job.find('span', class_='company').text.strip()
location = job.find('span', class_='subtext').find('a').text.strip()
jobs.append({'title': title, 'company': company, 'location': location})
with open('hn_jobs.csv', 'w', newline='', encoding='utf-8') as f:
writer = csv.DictWriter(f, fieldnames=['title', 'company', 'location'])
writer.writeheader()
writer.writerows(jobs)
HN Job Filter is a Python tool that automates the process of extracting job listings from Hacker News and exporting them as clean CSV files. This script is designed to save developers and recruiters hours of manual filtering work every week. It leverages the requests and beautifulsoup4 libraries to scrape job data and writes it to a CSV file with company, title, and location details.
The tool is built to be simple and efficient. It requires Python 3.7 or higher and can be run with minimal setup. Once installed, you can run the script and have a clean CSV file ready for use in your hiring or project tracking workflows. The script is fully automated and requires no user input, making it ideal for those looking to streamline their job data collection process.
import requests
from bs4 import BeautifulSoup
import csv
url = 'https://news.ycombinator.com/jobs'
response = requests.get(url)
soup = BeautifulSoup(response.text, 'html.parser')
job_listings = soup.find_all('tr', class_='athing')
jobs = []
for job in job_listings:
title = job.find('span', class_='titlelink').text.strip()
company = job.find('span', class_='company').text.strip()
location = job.find('span', class_='subtext').find('a').text.strip()
jobs.append({'title': title, 'company': company, 'location': location})
with open('hn_jobs.csv', 'w', newline='', encoding='utf-8') as f:
writer = csv.DictWriter(f, fieldnames=['title', 'company', 'location'])
writer.writeheader()\n writer.writerows(jobs)
The script is designed to be run once and then used as a reference for future job data collection. It filters out any placeholder or fake data, ensuring that the output is clean and ready for use. This is especially useful for remote hiring, where location-based filtering is critical. The script also supports exporting data to CSV, making it easy to integrate with other tools or platforms.
For developers and recruiters looking to automate their hiring process, HN Job Filter is an essential tool. It saves hours of manual work each week and provides a reliable source of job data from Hacker News. The script is fully automated and requires no user input, making it ideal for those who want to focus on hiring rather than data collection.
The tool is available for download at https://intellitools.gumroad.com/l/hn-job-filter. It includes a ready-to-run Python script, a detailed README file, and a sample output to help you get started quickly. With just a few lines of code, you can automate your job filtering process and save valuable time.
In summary, HN Job Filter is a powerful Python tool that helps developers and recruiters automate their hiring process by extracting and filtering job listings from Hacker News. It saves hours of manual work each week and provides a clean, reliable source of job data. Whether you're looking to streamline your hiring process or track job trends, this tool is a must-have for anyone working with Hacker News job listings.
Top comments (0)