Skip to main content

Fetch website data from https://news.ycombinator.com

Project description

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 :wink: 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fetch_hackernews-1.0.8.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fetch_hackernews-1.0.8-py2.py3-none-any.whl (8.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file fetch_hackernews-1.0.8.tar.gz.

File metadata

  • Download URL: fetch_hackernews-1.0.8.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for fetch_hackernews-1.0.8.tar.gz
Algorithm Hash digest
SHA256 18d44b27d4257a040c989522b024713c45a9d70b940ed71ceb4527bd25bfd2a7
MD5 1a2919853b00af48f167ec9ea24399e9
BLAKE2b-256 7e4283a9990cca8782e1c14b71a6323c660fda86cf24c7cd514d1ea949d36d70

See more details on using hashes here.

File details

Details for the file fetch_hackernews-1.0.8-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for fetch_hackernews-1.0.8-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 b8ff86abb0d3915345fc0a514af988d1838562fa35813631876ed58880901c13
MD5 1ce2777608dce7c4f8b8efa20af17fde
BLAKE2b-256 b1e2fd63ab5fab4788135be5bd070ffce01a2bc6bb0cf574887f07f706d448d0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page