Instantnews是一款能在Linux命令行中获取到即时新闻的软件,我们可以安装和配置Instantnews,从而在Linux终端下阅读世界各地发生的重大新闻。使用InstantNews阅读新闻画面:
安装方法 1.先安装PIP 1].Arch Linux: $ sudo pacman -S python-pip 2].Debian、Ubuntu、Linux Mint: $ sudo apt-get install python-pip 3].RHEL、Fedora、CentOS: $ sudo yum install python-pip 或者:$ sudo dnf install python-pip 4].SUSE/openSUSE:: $ sudo zypper install python-pip 2.安装PIP后用下面命令安装: $ pip install instantnews 3.从源代码安装: $ git clone https://github.com/shivam043/instantnews.git $ cd instantnew $ sudo python setup.py install
配置方法 Instantnews retrieves all news headlines from News API. For those wondering, 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: 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
用法 用法:instantnews [-h] [--show SHOW] [--show_all] [--news NEWS] 参数: -h, --help show this help message and exit --show SHOW, -s SHOW Shows all the news channel codes category wise --show_all, -sa Shows all the news channel codes --news NEWS, -n NEWS Shows news
List all available news channels Let us see the list of all available news channels. $ instantnews -sa Or: $ instantnews --show_all Sample output would be: News Code: <abc-news-au> ABC News (AU) News Code: <al-jazeera-english> Al Jazeera English News Code: <ars-technica> Ars Technica News Code: <associated-press> Associated Press News Code: <bbc-news> BBC News News Code: <bbc-sport> BBC Sport News Code: <bild> Bild News Code: <bloomberg> Bloomberg News Code: <breitbart-news> Breitbart News News Code: <business-insider> Business Insider News Code: <business-insider-uk> Business Insider (UK) News Code: <buzzfeed> Buzzfeed News Code: <cnbc> CNBC News Code: <cnn> CNN News Code: <daily-mail> Daily Mail News Code: <der-tagesspiegel> Der Tagesspiegel News Code: <die-zeit> Die Zeit News Code: <engadget> Engadget News Code: <entertainment-weekly> Entertainment Weekly News Code: <espn> ESPN News Code: <espn-cric-info> ESPN Cric Info News Code: <financial-times> Financial Times News Code: <focus> Focus News Code: <football-italia> Football Italia News Code: <fortune> Fortune News Code: <four-four-two> FourFourTwo News Code: <fox-sports> Fox Sports News Code: <google-news> Google News News Code: <gruenderszene> Gruenderszene News Code: <hacker-news> Hacker News News Code: <handelsblatt> Handelsblatt News Code: <ign> IGN News Code: <independent> Independent News Code: <mashable> Mashable News Code: <metro> Metro News Code: <mirror> Mirror News Code: <mtv-news> MTV News News Code: <mtv-news-uk> MTV News (UK) News Code: <national-geographic> National Geographic News Code: <new-scientist> New Scientist News Code: <newsweek> Newsweek News Code: <new-york-magazine> New York Magazine News Code: <nfl-news> NFL News News Code: <polygon> Polygon News Code: <recode> Recode News Code: <reddit-r-all> Reddit /r/all News Code: <reuters> Reuters News Code: <spiegel-online> Spiegel Online News Code: <t3n> T3n News Code: <talksport> TalkSport News Code: <techcrunch> TechCrunch News Code: <techradar> TechRadar News Code: <the-economist> The Economist News Code: <the-guardian-au> The Guardian (AU) News Code: <the-guardian-uk> The Guardian (UK) News Code: <the-hindu> The Hindu News Code: <the-huffington-post> The Huffington Post News Code: <the-lad-bible> The Lad Bible News Code: <the-new-york-times> The New York Times News Code: <the-next-web> The Next Web News Code: <the-sport-bible> The Sport Bible News Code: <the-telegraph> The Telegraph News Code: <the-times-of-india> The Times of India News Code: <the-verge> The Verge News Code: <the-wall-street-journal> The Wall Street Journal News Code: <the-washington-post> The Washington Post News Code: <time> Time News Code: <usa-today> USA Today News Code: <wired-de> Wired.de News Code: <wirtschafts-woche> Wirtschafts Woche
List news channels category wise To display all the news channel codes category wise, run: $ instantnews --show SHOW <category> Or: $ instantnews -s SHOW <category>
The following categories are available business entertainment gaming general music politics science-and-nature sport technology Now, to display news channels category wise, say technology, run: $ instantnews --show technology Or: $ instantnews -s technology Sample output would be: News Code: <ars-technica> Ars Technica News Code: <engadget> Engadget News Code: <gruenderszene> Gruenderszene News Code: <hacker-news> Hacker News News Code: <recode> Recode News Code: <t3n> T3n News Code: <techcrunch> TechCrunch News Code: <techradar> TechRadar News Code: <the-next-web> The Next Web News Code: <the-verge> The Verge News Code: <wired-de> Wired.de
读取新闻标题 如果要从TechCrunch读取新闻标题,运行下面命令: $ instantnews -n techcrunch
更多请运行instantnews -h 要显示更多的信息,显示帮助信息请运行下面命令: $ instantnews -h
相关主题 |