Skip to content
This repository has been archived by the owner on Mar 5, 2022. It is now read-only.

Terminal Reading Mode or Reader View

Zhiming Wang edited this page Apr 8, 2018 · 19 revisions

Asciicast

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.

  1. Install elinks. On Ubuntu:
sudo apt install elinks
  1. Save the following script as reader:
#!/bin/bash

elinks "http://justread.mpgarate.com/read?url=$1"

Using reader

  1. Get the latest reader.py script. Save it in your path.
  2. Install the dependencies. On Ubuntu:
sudo apt install python3-html2text jq
  1. Register and generate a personal API key at Mercury Web Parser
  2. 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.

Invoke reader from googler

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!