get newspaper from online leading Zimbabwe content providers
Project description
zim-newspaper
library to get newspaper, news from zim leading news providers
Example
from newspaperzw.Provider import Providers
from newspaperzw.news import News
# add your favourite news source so as to use its name only when getting news data
p = Providers(provider={'techzim': 'https://www.techzim.co.zw/'})
# get all preset news sources and url
all = Providers().getAll()
try:
# get data from news site by name, default = `herald`
api = News(provider='techzim')
news_data = api.paper()
# return dict with all news data, best to use `prettyprinter`
print(new_data)
except Exception as e:
print("There was a problem: ", e)
Get summary of article
- to get summary through NLP function,
nltkis needed as dependent - this returns same results as above but with a summary attribute that contains a summary of the article
from newspaperzw.Provider import Providers
from newspaperzw.news import News
try:
# get data from news site by name, default = `herald`
api = News(provider='techzim', summary=True)
news_data = api.paper()
# return dict with all news data, best to use `prettyprinter`
print(new_data)
except Exception as e:
print("There was a problem: ", e)
NEW!
added flag to set or disable cache
# __version__1.1.0
from newspaperzw.Provider import Providers
from newspaperzw.news import News
'''
get a summary of the article from each article through the `summary=True` flag
avoid cache memory by disabling it through the `cache=False` flag
if cache is True, it will not return news previously downloaded on previous runs
'''
try:
# get data from news site by name, default = `herald`
api = News(provider='techzim', summary=True, cache=False)
news_data = api.paper()
# return dict with all news data, best to use `prettyprinter`
print(new_data)
except Exception as e:
print("There was a problem: ", e)
TODO
-
library scrapes all available data that it encounters, need to narrow it down by date/month/year
-
start from
todayup to any news obtained fromlast year -
improve speed
-
disble logging
-
date published
-
log files need to be deleted in case they occupy signficant space on disk
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file newspaper-zw-1.1.0.tar.gz.
File metadata
- Download URL: newspaper-zw-1.1.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62544ce3acdc363f894233a4fc5ba261521232bd1e320cb4d10fcc61593e4deb
|
|
| MD5 |
b2735cdb106ee4a9700aa138a4d063b0
|
|
| BLAKE2b-256 |
ff043c29b41fee17ab2f6e3167b1c736b2728adccf76492941cc9908ee55658a
|
File details
Details for the file newspaper_zw-1.1.0-py3-none-any.whl.
File metadata
- Download URL: newspaper_zw-1.1.0-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74d4f810c9b84ebe701475a5d3a29b96f540da40e976c5aa464437d9aaf8b22a
|
|
| MD5 |
a2938e66b559dfd9617d3ce595cbc028
|
|
| BLAKE2b-256 |
b90400a3759cb19177b7f4c41fa502462d24acacf7be098a1339ac7df8744bee
|