Fetch website data from https://news.ycombinator.com
Project description
fetch-hackernews
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.8
requests
beautifulsoup4
Install
$ pip3 install fetch_hackernews
Usage
Start the program with:
$ 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…
##############################
# #
# Hackernews #
# #
##############################
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
Built Distribution
File details
Details for the file fetch_hackernews-1.0.7.tar.gz
.
File metadata
- Download URL: fetch_hackernews-1.0.7.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f03ab0be6772ab4784bb224fc0291caeffc3c035813f0be3756bbbe2bf59c29 |
|
MD5 | 9cb20d62a77718ab3dbbff711f84d8ce |
|
BLAKE2b-256 | 294dc16f4a65f115465563bdc8531e67389bd332e111cb7197f762258fc943f8 |
File details
Details for the file fetch_hackernews-1.0.7-py2.py3-none-any.whl
.
File metadata
- Download URL: fetch_hackernews-1.0.7-py2.py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2dfc0950d4f358ef4f1e1874fb9dacd9901022dd21485aae616417e48ce4c8a6 |
|
MD5 | f471928ceaf1c3f4c612c5f37b1825b9 |
|
BLAKE2b-256 | c414f14f2c0f02a17f3ba6d6244b044235927fbd705fa30dbe2f0efdeb358640 |