HackerNews+ is a Python-based web scraper that extracts top-voted stories (100+ points) from Hacker News and generates a webpage displaying the results.
Scrapes multiple pages of Hacker News
Filters stories with 100+ votes
Sorts stories in descending order by vote count
Generates a styled HTML file (output.html)
Automatically opens the generated page in a browser
- Sends requests to Hacker News pages using
requests. - Parses the HTML using
BeautifulSoup. - Extracts titles, links, and vote counts for posts with 100+ votes.
- Sorts the posts in descending order based on votes.
- Uses Jinja2 templating to dynamically create an HTML page.
- Applies CSS styling for better readability.
- Opens the generated webpage automatically after execution.
Ensure you have Python 3.x installed.
Then, install the required dependencies:
pip install requests beautifulsoup4 jinja2Run the script by executing the following command:
python main.pyWhen prompted, enter the number of pages you wish to scrape.
- The script will fetch and process the Hacker News posts.
- A new file, output.html, will be created with the extracted stories.
- The file will automatically open in your default web browser.
You can modify the HTML template (templates/index.html) and CSS styles (static/style.css) to enhance the appearance of the generated page.