Clinews – Read News And Latest Headlines From Commandline
A while ago, we have written about a CLI news client named InstantNews that helps you to read news and latest headlines from commandline instantly. Today, I stumbled upon a similar utility named Clinews which serves the same purpose – reading news and latest headlines from popular websites, blogs from Terminal. You don’t need to install GUI applications or mobile apps. You can read what’s happening in the world right from your Terminal. It is free, open source utility written using NodeJS.
Since Clinews is written using NodeJS, you can install it using NPM package manager. If you haven’t install NodeJS, install it as described in the following link.
Once node installed, run the following command to install Clinews:
$ npm i -g clinews
You can also install Clinews using Yarn:
$ yarn global add clinews
Yarn itself can installed using npm
$ npm -i yarn
Configure News API
Clinews retrieves all news headlines from News API. News API is a simple and easy-to-use API that returns JSON metadata for the headlines currently published on a range of news sources and blogs. It currently provides live headlines from 70 popular sources, including Ars Technica, BBC, Blooberg, CNN, Daily Mail, Engadget, ESPN, Financial Times, Google News, hacker News, IGN, Mashable, National Geographic, Reddit r/all, Reuters, Speigel Online, Techcrunch, The Guardian, The Hindu, The Huffington Post, The Newyork Times, The Next Web, The Wall street Journal, USA today and more.
First, you need an API key from News API. Go to https://newsapi.org/register URL and register a free account to get the API key.
Once you got the API key from News API site, edit your .bashrc file:
$ vi ~/.bashrc
Add newsapi API key at the end like below:
Please note that you need to paste the key inside the double quotes. Save and close the file.
Run the following command to update the changes.
$ source ~/.bashrc
Done. Now let us go ahead and fetch the latest headlines from new sources.
Read News And Latest Headlines From Commandline
To read news and latest headlines from specific new source, for example The Hindu, run:
$ news fetch the-hindu
Here, “the-hindu” is the new source id (fetch id).
The above command will fetch latest 10 headlines from The Hindu news portel and display them in the Terminal. Also, it displays a brief description of the news, the published date and time, and the actual link to the source.
To read a news in your browser, hold Ctrl key and click on the URL. It will open in your default web browser.
To view all the sources you can get news from, run:
$ news sources
As you see in the above screenshot, Clinews lists all news sources including the name of the news source, fetch id, description of the site, website URL and the country where it is located. As of writing this guide, Clinews currently supports 70+ news sources.
Clinews can also able to search for news stories across all sources matching search criteria/term. Say for example, to list all news stories with titles containing the words “Tamilnadu”, use the following command:
$ news search "Tamilnadu"
This command will scrap all news sources for stories that match term Tamilnadu.
Clinews has some extra flags that helps you to
- limit the amount of news stories you want to see,
- sort news stories (top, latest, popular),
- display news stories category wise (E.g. business, entertainment, gaming, general, music, politics, science-and-nature, sport, technology)
For more details, see the help section:
$ clinews -h
And, that’s all for now. Hope this was useful. More good stuffs to come. Stay tuned!
Thanks for stopping by!
Help us to help you:
- Subscribe to our Email Newsletter : Sign Up Now
- Support OSTechNix : Donate Via PayPal
- Download free E-Books and Videos : OSTechNix on TradePub
- Connect with us: Facebook | Twitter | Google Plus | LinkedIn | RSS feeds
Have a Good day!!