mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-29 21:41:00 +08:00
Merge remote-tracking branch 'LCTT/master'
This commit is contained in:
commit
ffdd689f7f
@ -1,4 +1,4 @@
|
||||
Rock Solid React.js Foundations: A Beginner’s Guide
|
||||
GraveAccent翻译中 Rock Solid React.js Foundations: A Beginner’s Guide
|
||||
============================================================
|
||||
** 此处有Canvas,请手动处理 **
|
||||
|
||||
@ -289,4 +289,4 @@ via: https://medium.freecodecamp.org/rock-solid-react-js-foundations-a-beginners
|
||||
[9]:https://codepen.io/raynesax/pen/QaROqK
|
||||
[10]:https://twitter.com/rajat1saxena
|
||||
[11]:mailto:rajat@raynstudios.com
|
||||
[12]:https://www.youtube.com/channel/UCUmQhjjF9bsIaVDJUHSIIKw
|
||||
[12]:https://www.youtube.com/channel/UCUmQhjjF9bsIaVDJUHSIIKw
|
||||
|
@ -1,138 +0,0 @@
|
||||
translating----geekpi
|
||||
|
||||
Clinews – Read News And Latest Headlines From Commandline
|
||||
======
|
||||
|
||||
![](https://www.ostechnix.com/wp-content/uploads/2018/09/clinews-720x340.jpeg)
|
||||
|
||||
A while ago, we have written about a CLI news client named [**InstantNews**][1] 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**.
|
||||
|
||||
### Installing Clinews
|
||||
|
||||
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**][2]. 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**][3].
|
||||
|
||||
First, you need an API key from News API. Go to [**https://newsapi.org/register**][4] 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:
|
||||
|
||||
```
|
||||
export IN_API_KEY="Paste-API-key-here"
|
||||
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
**Sample output:**
|
||||
|
||||
![](https://www.ostechnix.com/wp-content/uploads/2018/09/clinews-1.png)
|
||||
|
||||
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
|
||||
|
||||
```
|
||||
|
||||
**Sample output:**
|
||||
|
||||
![](https://www.ostechnix.com/wp-content/uploads/2018/09/clinews-2.png)
|
||||
|
||||
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!
|
||||
|
||||
Cheers!
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.ostechnix.com/clinews-read-news-and-latest-headlines-from-commandline/
|
||||
|
||||
作者:[SK][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.ostechnix.com/author/sk/
|
||||
[1]: https://www.ostechnix.com/get-news-instantly-commandline-linux/
|
||||
[2]: https://newsapi.org/
|
||||
[3]: https://newsapi.org/sources
|
||||
[4]: https://newsapi.org/register
|
@ -1,3 +1,5 @@
|
||||
translating---geekpi
|
||||
|
||||
How to Boot Ubuntu 18.04 / Debian 9 Server in Rescue (Single User mode) / Emergency Mode
|
||||
======
|
||||
Booting a Linux Server into a single user mode or **rescue mode** is one of the important troubleshooting that a Linux admin usually follow while recovering the server from critical conditions. In Ubuntu 18.04 and Debian 9, single user mode is known as a rescue mode.
|
||||
|
@ -0,0 +1,137 @@
|
||||
Clinews - 从命令行阅读新闻和最新头条
|
||||
======
|
||||
|
||||
![](https://www.ostechnix.com/wp-content/uploads/2018/09/clinews-720x340.jpeg)
|
||||
|
||||
不久前,我们写了一个名为 [**InstantNews**][1] 的命令行新闻客户端,它可以帮助你立即在命令行阅读新闻和最新头条新闻。今天,我偶然发现了一个名为 **Clinews** 的类似,它的其功能与此相同 - 在终端阅读来自热门网站的新闻和最新头条,还有博客。你无需安装 GUI 应用或移动应用。你可以直接从终端阅读世界上正在发生的事情。它是使用 **NodeJS** 编写的免费开源程序。
|
||||
|
||||
|
||||
### 安装 Clinews
|
||||
|
||||
由于 Clinews 是使用 NodeJS 编写的,因此你可以使用 NPM 包管理器安装。如果尚未安装 NodeJS,请按照以下链接中的说明进行安装。
|
||||
|
||||
安装 node 后,运行以下命令安装 Clinews:
|
||||
|
||||
```
|
||||
$ npm i -g clinews
|
||||
```
|
||||
|
||||
你也可以使用 **Yarn** 安装 Clinews:
|
||||
|
||||
```
|
||||
$ yarn global add clinews
|
||||
```
|
||||
|
||||
Yarn 本身可以使用 npm 安装
|
||||
|
||||
```
|
||||
$ npm -i yarn
|
||||
```
|
||||
|
||||
### 配置 News API
|
||||
|
||||
Clinews 从 [**News API**][2] 中检索所有新闻标题。News API 是一个简单易用的API,它返回当前在一系列新闻源和博客上发布的头条的 JSON 元数据。它目前提供来自 70 个热门源的实时头条,包括 Ars Technica、BBC、Blooberg、CNN、每日邮报、Engadget、ESPN、金融时报、谷歌新闻、hacker News,IGN、Mashable、国家地理、Reddit r/all、路透社、 Speigel Online、Techcrunch、The Guardian、The Hindu、赫芬顿邮报、纽约时报、The Next Web、华尔街日报,今日美国和[**等等**][3]。
|
||||
|
||||
首先,你需要 News API 的 API 密钥。进入 [**https://newsapi.org/register**][4] 并注册一个免费帐户来获取 API 密钥。
|
||||
|
||||
从 News API 获得 API 密钥后,编辑 **.bashrc**:
|
||||
|
||||
```
|
||||
$ vi ~/.bashrc
|
||||
|
||||
```
|
||||
|
||||
在最后添加 newsapi API 密钥,如下所示:
|
||||
|
||||
```
|
||||
export IN_API_KEY="Paste-API-key-here"
|
||||
|
||||
```
|
||||
|
||||
请注意,你需要将密钥粘贴在双引号内。保存并关闭文件。
|
||||
|
||||
运行以下命令以更新更改。
|
||||
|
||||
```
|
||||
$ source ~/.bashrc
|
||||
|
||||
```
|
||||
|
||||
完成。现在继续并从新闻源获取最新的头条新闻。
|
||||
|
||||
### 在命令行阅读新闻和最新头条
|
||||
|
||||
要阅读特定新闻源的新闻和最新头条,例如 **The Hindu**,请运行:
|
||||
|
||||
```
|
||||
$ news fetch the-hindu
|
||||
|
||||
```
|
||||
|
||||
这里,**“the-hindu”** 是新闻源的源id(获取 id)。
|
||||
|
||||
上述命令将从 The Hindu 新闻站获取最新的 10 个头条,并将其显示在终端中。此外,它还显示新闻的简要描述、发布的日期和时间以及到源的实际链接。
|
||||
|
||||
**示例输出:**
|
||||
|
||||
![](https://www.ostechnix.com/wp-content/uploads/2018/09/clinews-1.png)
|
||||
|
||||
要在浏览器中阅读新闻,请按住 Ctrl 键并单击 URL。它将在你的默认 Web 浏览器中打开。
|
||||
|
||||
要查看所有的新闻源,请运行:
|
||||
|
||||
```
|
||||
$ news sources
|
||||
|
||||
```
|
||||
|
||||
**示例输出:**
|
||||
|
||||
![](https://www.ostechnix.com/wp-content/uploads/2018/09/clinews-2.png)
|
||||
|
||||
正如你在上面的截图中看到的,Clinews 列出了所有新闻源,包括新闻源的名称、获取 ID、网站描述、网站 URL 以及它所在的国家/地区。在撰写本指南时,Clinews 目前支持 70 多个新闻源。
|
||||
|
||||
Clinews 还可以搜索符合搜索条件/术语的所有源的新闻报道。例如,要列出包含单词 **“Tamilnadu”** 的所有新闻报道,请使用以下命令:
|
||||
|
||||
```
|
||||
$ news search "Tamilnadu"
|
||||
```
|
||||
|
||||
此命令将会筛选所有新闻源中含有 **Tamilnadu** 的报道。
|
||||
|
||||
Clinews有一些额外的标志可以帮助你
|
||||
|
||||
* 限制你想看的新闻报道的数量,
|
||||
* 排序新闻报道(热门、最新),
|
||||
* 智能显示新闻报道分类(例如商业、娱乐、游戏、大众、音乐、政治、科学和自然、体育、技术)
|
||||
|
||||
|
||||
|
||||
更多详细信息,请参阅帮助部分:
|
||||
|
||||
```
|
||||
$ clinews -h
|
||||
```
|
||||
|
||||
就是这些了。希望这篇对你有用。还有更多好东西。敬请关注!
|
||||
|
||||
干杯!
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.ostechnix.com/clinews-read-news-and-latest-headlines-from-commandline/
|
||||
|
||||
作者:[SK][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.ostechnix.com/author/sk/
|
||||
[1]: https://www.ostechnix.com/get-news-instantly-commandline-linux/
|
||||
[2]: https://newsapi.org/
|
||||
[3]: https://newsapi.org/sources
|
||||
[4]: https://newsapi.org/register
|
Loading…
Reference in New Issue
Block a user