This repository has been archived by the owner on Mar 5, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 531
Terminal Reading Mode or Reader View
Zhiming Wang edited this page Apr 8, 2018
·
19 revisions
Reader View in action!
Looking for a distraction-free reading mode like the modern browsers have? Here are some techniques to read news in a clean, ad-free environment in your terminal with googler
. All of them use the Mercury Web Parser API indirectly.
Using JustRead
You can fetch cleansed data from JustRead by tweaking the url you want to fetch.
- Install
elinks
. On Ubuntu:
sudo apt install elinks
- Save the following script as
reader
:
#!/bin/bash
elinks "http://justread.mpgarate.com/read?url=$1"
Using reader
- Get the latest
reader.py
script. Save it in your path. - Install the dependencies. On Ubuntu:
sudo apt install python3-html2text jq
- Register and generate a personal API key at Mercury Web Parser
- Save the following script as
reader
:
#!/bin/sh
reader.py "$1" -k mercury_key -w 100 | jq -r '[
(if .title then "# "+.title else empty end),
(if .author then .author else empty end),
.content.text
] | join("\n\n")' | "$PAGER"
Note that mercury_key
needs to be replaced with the API key generated in step 2. The text is piped to the PAGER
.
To invoke reader when reading news in googler
, add the following alias in your shell's rc file:
alias news='googler -N --url-handler reader'
You can add your personal preferences like language, country etc.
Fire news
with keywords to read the latest news!