Skip to content

samnunn/hackernews-scraper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yesterday's News

I like to keep up to date with what’s trending on Hacker News, but not too up to date. This is a little script that makes a JSON feed with yesterday's top thirty stories, complete with links to the original item and to the comments section. I read it in NetNewsWire.

Dependencies

I use pipenv to install and manage Python libraries. In this case, it will install:

Usage

Installation

git clone https://github.com/samnunn/hackernews-scraper
cd hackernews-scraper
pipenv install

Setup

You need to provide the script with a URL where you intend to host your feed on the Web and an output path where you intend to save the feed on your machine. Do this by setting environment variables, which Pipenv automatically loads from a .env. You can create one with your own details like so:

echo HN_FEED_BASEURL="https://example.com/feeds" >.env  # where you plan to serve the feed from, no trailing slash
echo HN_FEED_BASEPATH="/var/www/feeds/" >> .env         # where on this machine you intend to save the .json file

Running It

~/.pyenv/shims/pipenv run python hackernews-scraper.py

You can trigger this however you like. If your server is a Mac, consider using a simple Keyboard Maestro macro with the do shell script action on a time of day trigger. For the brave, there's always launchd.

About

A little script that makes a digest of yesterday's top thirty stories on Hacker News.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages