DEV Community

IntelliTools
IntelliTools

Posted on

Automate HackerNews Job Filtering with Python Script

import requests
from bs4 import BeautifulSoup

def fetch_hn_jobs():
    url = 'https://news.ycombinator.com/jobs'
    response = requests.get(url)
    soup = BeautifulSoup(response.text, 'html.parser')
    jobs = []

    for item in soup.select('.athing'): 
        title = item.select_one('.titleline')
        if title:
            link = title.find('a')['href'] if title.find('a') else ''
            jobs.append({'title': title.text.strip(), 'link': link})
    return jobs
Enter fullscreen mode Exit fullscreen mode

The HackerNews Job Auditor is a Python script that automates the process of filtering and scoring high-quality tech jobs from Hacker News. This tool saves developers and recruiters hours of manual work by automatically screening jobs for technical depth and relevance. By leveraging Python’s requests and BeautifulSoup libraries, the script fetches job listings and processes them into a structured format.

import pandas as pd
from datetime import datetime

def audit_jobs(jobs):
    scored_jobs = []
    for job in jobs:
        score = 0
        if 'python' in job['title'].lower():
            score += 1
        if 'engineer' in job['title'].lower():
            score += 1
        if 'remote' in job['title'].lower():
            score += 1
        scored_jobs.append({'title': job['title'], 'link': job['link'], 'score': score})
    return pd.DataFrame(scored_jobs).sort_values('score', ascending=False)
Enter fullscreen mode Exit fullscreen mode

The script includes a scoring system that evaluates each job based on keywords like 'python', 'engineer', and 'remote'. This scoring mechanism helps users quickly identify the most relevant opportunities. The output is a pandas DataFrame that sorts jobs by their technical relevance, making it easy to export to CSV or other formats.

if __name__ == '__main__':
    jobs = fetch_hn_jobs()
    df = audit_jobs(jobs)
    print(df.head())
Enter fullscreen mode Exit fullscreen mode

Running the script will fetch the latest Hacker News job listings, score them, and display the top results in the console. The script is designed to be simple to run and extend, with a requirements.txt file that includes all necessary dependencies. This ensures that you can start using it immediately with a single pip install -r requirements.txt command.

The HackerNews Job Auditor is built for developers and recruiters who want to streamline their job screening process. It filters noise and highlights meaningful opportunities, allowing you to focus on the most relevant tech jobs. Whether you're looking for remote Python roles or engineering positions, this tool helps you find what matters in seconds, not hours.

For a complete setup and sample output, visit https://intellitools.gumroad.com/l/hackernews-job-auditor. The included README.txt provides step-by-step instructions to get the script up and running, making it an ideal tool for anyone looking to improve their productivity with Python automation.

Top comments (0)