Skip to main content

fetch-hackernews

Static Badge Static Badge GitHub License Github Issues PyPi Version GitHub last commit

A simple program to fetch Hackernews from news.ycombinator.com written in Python.

I know, there are already some similar projects via PyPi available, but I said to myself, why not add one more app 😉 It gave me the opportunity to finally deal with the subject of web scraping (with BeautifulSoup).

Operating System

macOS, Linux and Windows

Requirements

  • Python >= 3.12
  • requests
  • beautifulsoup4

Install

$ pip3 install fetch_hackernews

Usage

Start the program with following command:

$ fetch_hackernews

This shows you the 30 most recent messages. The output looks similar to the one shown below:

Found no local index.html file.
Fetch data from https://news.ycombinator.com…

##############################
#                            #
#      Fetch Hacker News     #
#       Version: 1.0.7       #
#                            #
##############################

1 - Red Light Green Light
Link: https://jamessevedge.com/articles/red-light-green-light/

2 - You can now send replies from your Duck Addresses
Link: https://duckduckgo.com/email/faq
…

After running this program, an index.html file is created locally. This reduces requests to the server from news.ycombinator.com.

So, all news will be read from the local index.html file. This program will search for such a file. If no file has been created yet, it will create this file, download the content (using requests) and save it. After that, the content will be parsed using BeautifulSoup.

By default, the index.html file is only updated every six hours.

The index.html file is stored in the following directory (macOS):

~/.config/hackernews

Changelog

see Changelog.md

Metadata

Release files for fetch-hackernews 1.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fetch-hackernews 1.0.8
File Size Uploaded Provenance
fetch_hackernews-1.0.8.tar.gz 7.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for fetch-hackernews 1.0.8
File Interpreter ABI Platform
fetch_hackernews-1.0.8-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 16.1 kB

Release files / fetch_hackernews-1.0.8.tar.gz

Download URL fetch_hackernews-1.0.8.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
18d44b27d4257a040c989522b024713c45a9d70b940ed71ceb4527bd25bfd2a7
BLAKE2b-256 checksum
How to use checksums
7e4283a9990cca8782e1c14b71a6323c660fda86cf24c7cd514d1ea949d36d70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release files / fetch_hackernews-1.0.8-py2.py3-none-any.whl

Download URL fetch_hackernews-1.0.8-py2.py3-none-any.whl
Size 8.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
b8ff86abb0d3915345fc0a514af988d1838562fa35813631876ed58880901c13
BLAKE2b-256 checksum
How to use checksums
b1e2fd63ab5fab4788135be5bd070ffce01a2bc6bb0cf574887f07f706d448d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Security for fetch-hackernews 1.0.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page