import requests
from bs4 import BeautifulSoup
import csv
# Fetch Hacker News job listings
url = 'https://news.ycombinator.com/jobs'
response = requests.get(url)
html = response.text
soup = BeautifulSoup(html, 'html.parser')
# Extract job titles and links
jobs = soup.find_all('tr', class_='athing')
job_data = []
for job in jobs:
title = job.find('span', class_='titlelink').text.strip()
link = job.find('span', class_='titlelink')['href']
company = job.find('span', class_='subline').text.strip()
job_data.append({'title': title, 'link': link, 'company': company})
# Export to CSV
with open('hn_jobs.csv', 'w', newline='', encoding='utf-8') as csvfile:
fieldnames = ['title', 'link', 'company']
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
writer.writeheader()
writer.writerows(job_data)
HN Job Scraper Pro is a Python tool that automates the process of extracting job listings from Hacker News. It eliminates the need for manual scraping by handling the entire workflow—fetching, parsing, and exporting data—into a clean CSV format. This tool is especially useful for remote developers and recruiters who need real-time access to job opportunities on Hacker News.
The script above demonstrates the core functionality of the scraper. It uses the requests library to fetch the HTML content of the Hacker News jobs page, and BeautifulSoup to parse the data. The job titles, links, and company names are then extracted and saved to a CSV file. This script is part of the HN Job Scraper Pro package, which includes additional features like job filtering, data export, and real-time alerts.
One of the key benefits of HN Job Scraper Pro is its ability to save developers and recruiters significant time. Instead of manually copying and pasting job listings, the tool automates the process, allowing users to focus on more strategic tasks. For example, the script can be configured to filter jobs by location, type, and date range, making it easier to track hiring trends or stay updated with the latest remote opportunities.
# Example of filtering jobs by location
filtered_jobs = [job for job in job_data if 'remote' in job['company'].lower()]
# Export filtered jobs to CSV
with open('remote_hn_jobs.csv', 'w', newline='', encoding='utf-8') as csvfile:
fieldnames = ['title', 'link', 'company']
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
writer.writeheader()
writer.writerows(filtered_jobs)
This snippet shows how the tool can be extended to filter jobs based on location. By using list comprehensions, users can quickly narrow down their job search to specific criteria, such as remote work or full-time positions. The output is then saved to a new CSV file, ensuring that the data remains organized and accessible.
HN Job Scraper Pro also provides daily job summaries, which can be used to track hiring trends over time. These summaries are generated automatically and can be customized to include specific metrics, such as the number of jobs posted per day or the most active companies in the remote hiring space. This feature is particularly valuable for recruiters who need to make data-driven decisions.
In addition to its automation capabilities, the tool is designed to be easy to use. The package includes a README.txt file with step-by-step setup instructions, ensuring that users can get started quickly. The requirements.txt file simplifies the installation process by allowing users to install all dependencies with a single pip install -r requirements.txt command.
For developers and recruiters looking to streamline their job tracking process, HN Job Scraper Pro offers a powerful solution. By automating the scraping and filtering of Hacker News job listings, it saves hours of manual work each week. Whether you're a remote developer searching for new opportunities or a recruiter looking to stay ahead of the curve, this tool can help you achieve your goals more efficiently.
To learn more about HN Job Scraper Pro and how it can benefit your workflow, visit https://intellitools.gumroad.com/l/hn-job-scraper-pro.
Top comments (0)