Command line script to download articles for offline viewing as simple HTML, themed html, epub or markdown.
This is a brute force fishscript (shell) gluing together pandoc and a Node.js package that implements the Firefox reader view. It uses a NPM package implementing Mozilla's Readability script to scrape off ads, sidebars, footers, headers, etc. If that's not the right solution for you, jump down to the alternatives section at the end.
Currently, I use this as an alternative to Wallabag or Pocket to download articles I've meant to read later, converting them to epubs with bookmobile. Once a week I drop them on my micro-sd card and load it in my 10 year old offline e-ink e-reader (a Nook Simple Touch, ultra-cheap on eBay!).
- fish shell
- Node.js / NPM
npm install readability-cli git clone https://tildegit.org/exquisitecorp/bookmobile.git
By default bookmobile will download the specified url and save to the current directory as a simplified html document with readability.
Bookmobile: Simple command line script to download articles for offline reading as html, epub or markdown. Saves a simplified html document to current directory as default. Optionally, you can specify a theme, format, filename and output directory Usage: ./bookmobile url [ --theme THEME ] [ --format FORMAT ] [ --name FILENAME ] [ --output OUTPUT ] [-h | --help ] Options: --help -h Display usage info --theme THEME -t THEME Set theme for reader format. Default: medium Theme options: github gmi medium now pandoc --format FORMAT -f FORMAT Set file format (html, reader, markdown, epub) default: html --name NAME -n NAME Set specified file name instead of defaulting to article title --output OUTPUT -o OUTPUT Set output location default: current directory
To add themes
The themes subdirectory contains several custom simple themes for rendering a nice reader view. You can edit or add themes here and they will display in the usage help.
Fish shell function
I use the Fish Shell, an alternative to BASH.
Fish allows use of Functions, which are mostly equivalent to Bash aliases, which let you make easy-to-type shortcuts in the command line.
Since my most common workflow is to download an article and save as an epub, I created the epubmobile shortcut. If you use fish shell you can move to your
~/.config/fish/functions/ folder. Be sure to edit the file to match your own paths. The first path should match the location of bookmobile on your system, and the next should indicate where you want your epubs to automatically be placed. Make sure the original bookmobile is executable on your system using chmod + x.
A simple yad-based GUI application is included as well.
To install on Debian/*buntu-based systems:
apt install yad. Then
chmod +x bookmobile.gui to make it executable.
It can be launched from the command line with
./bookmobile-gui or you can create an executable.
Currently there are a number of CLI programs that are ports of the Readability project. These may serve your needs better.
A partial listing can be found here
Polite issues and pull requests will be considered!