DEV Community

IntelliTools
IntelliTools

Posted on

HN Job Scraper Pro: Real-Time Hacker News Job Automation with Python

import requests
from bs4 import BeautifulSoup
import csv

# Fetch Hacker News job listings
response = requests.get('https://news.ycombinator.com/jobs')
html = response.text
soup = BeautifulSoup(html, 'html.parser')

# Extract job titles and links
jobs = []
for item in soup.select('.athing'):  # Adjust selector if needed
    title = item.select_one('.titlelink').text
    link = item.select_one('.titlelink')['href']
    jobs.append((title, link))

# Export to CSV
with open('hn_jobs.csv', 'w', newline='', encoding='utf-8') as f:
    writer = csv.writer(f)
    writer.writerow(['Title', 'Link'])
    writer.writerows(jobs)
Enter fullscreen mode Exit fullscreen mode

HN Job Scraper Pro is a Python tool that automates the process of extracting real-time job listings from Hacker News. It eliminates the need for manual scraping, saving developers and recruiters hours of work each week. The script fetches job data from the Hacker News jobs page and exports it to a clean CSV file, making it easy to track trends or integrate with other systems.

The tool is designed for remote developers and recruiters who rely on Hacker News for job opportunities. By automating the scraping process, it ensures that users always have the latest job data without having to manually sift through the site. The script is ready to run, requiring only Python 3.7+ and the necessary libraries, which can be installed with a single pip install -r requirements.txt command.

# Example of filtering jobs by location
filtered_jobs = [job for job in jobs if 'remote' in job[0].lower() or 'remote' in job[1].lower()]

# Export filtered jobs to CSV
with open('remote_hn_jobs.csv', 'w', newline='', encoding='utf-8') as f:
    writer = csv.writer(f)
    writer.writerow(['Title', 'Link'])
    writer.writerows(filtered_jobs)
Enter fullscreen mode Exit fullscreen mode

One of the key benefits of HN Job Scraper Pro is its ability to filter jobs based on location, type, and date range. This makes it easy to focus on relevant opportunities and streamline the hiring or career tracking process. The tool also supports exporting data to CSV, ensuring that users have a structured format for further analysis.

For developers looking to integrate this functionality into their workflow, the script is a great starting point. It demonstrates how to use Python's requests and BeautifulSoup libraries to scrape data from a website and export it to a file. The included requirements.txt ensures that all dependencies are installed with minimal effort, making it simple to get up and running.

The tool also includes a sample output file that shows exactly what the script produces, helping users understand the structure of the exported data. This is particularly useful for those who are new to scraping or data export and want to see how the data is formatted before using it in their own projects.

If you're looking for a way to automate your job tracking or hiring process, HN Job Scraper Pro is a powerful solution. It combines the simplicity of Python with the real-time data from Hacker News to provide a seamless experience for developers and recruiters alike. The script is lightweight, easy to customize, and ready to use out of the box.

You can find the full script and all the necessary files at https://intellitools.gumroad.com/l/hn-job-scraper-pro. This is the perfect tool for anyone who wants to save time and stay ahead of the curve in the fast-paced world of remote hiring.

Top comments (0)