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
Metadata
Release files for newspaper-zw 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| newspaper-zw-1.1.0.tar.gz | 4.1 kB | Without provenance | Details for newspaper-zw-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| newspaper_zw-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for newspaper_zw-1.1.0-py3-none-any.whl |
Total release size: 9.7 kB
Release files / newspaper-zw-1.1.0.tar.gz
| Download URL | newspaper-zw-1.1.0.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
62544ce3acdc363f894233a4fc5ba261521232bd1e320cb4d10fcc61593e4deb
|
|
BLAKE2b-256 checksum How to use checksums |
ff043c29b41fee17ab2f6e3167b1c736b2728adccf76492941cc9908ee55658a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / newspaper_zw-1.1.0-py3-none-any.whl
| Download URL | newspaper_zw-1.1.0-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
74d4f810c9b84ebe701475a5d3a29b96f540da40e976c5aa464437d9aaf8b22a
|
|
BLAKE2b-256 checksum How to use checksums |
b90400a3759cb19177b7f4c41fa502462d24acacf7be098a1339ac7df8744bee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Security for newspaper-zw 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.