0 purchases
uninews 0.0.9
uninews
a universal news feed api for all news provider
Installation
pip install uninews
Supported providers
TheNewsApp
NewsCatcherApi
NewsData.io
GoogleNews
Usage
Using thenewsapi provider
from uninews import NewsFeed
from TheNewsApi import set_app_info
set_app_info(appkey=mykey)
nf = NewsFeet('TheNewsApp')
x = nf.last_news()
print(x)
x = nf.hist_news()
print(x)
x = nf.sources()
print(x)
Features
NewsFeed provide four type news get methods:
last_news:
get last news from the specified provider
hist_news:
get history news from the specified provider
sources:
get the provider's sources of news
if the provider do not provide the method, it will return None
Return data structure
News data
The news data return by last_news() and hist_news() methods are the same, t is a dictionary data which contains:
total
total record returned
articles
a array contain all the articles
Article data
article is a dict contains following keys:
title
the article's title
description
the summary description
content
the article body
link
the url address to the article
img_link
the article image url address
video_link
the video url address of article
publish_date
the article publish date
countries
countries of the article
categories
categories of the article
author
article's author
source_id
source id of the article
language
article's language
sources data
total
sources
source data
id
name
link
language
categories
description
countries
provider
the following provider is tested
newsdataio for https://newsdata.io
news_yapi for newsapi
thenewsapi for thenewsapi
working on provider
google feed news provider
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.