Skip to main content

Google-News-Feed

A simple python library to consume the google news rss feed.

Inspired by pygooglenews and implemented using aiohttp and lxml.

Installation

Via pip: pip install google-news-feed

How to use

from google_news_feed import GoogleNewsFeed

gnf = GoogleNewsFeed(language='en',country='US')
results = gnf.query("python")
print(results)

For more information about the query parameters see here.

Get Top Headlines

gnf = GoogleNewsFeed(language='en',country='US')
results = gnf.top_headlines()

Query a specific topic

gnf = GoogleNewsFeed(language='en',country='US')
results = gnf.query_topic("business")

For more topics see here.

Accessing the results

The results are a list of NewsItems.

result = gnf.query("python")[0]
print(result.title)
print(result.link)
print(result.pubDate)
print(result.description)
print(result.source)

Handling internal links

Some links are internal to google news. To access the actual link to the news site the internal link has to be accessed and the redirect url is returned. To simplify this process the resolve_internal_links property can be set to True.

gnf = GoogleNewsFeed(language='en',country='US',resolve_internal_links=True)
print(gnf.top_headlines()[0].link)

The resolution is handled asynchronously by default, but can be forced to be done synchronously via the run_async parameter.

Metadata

Release files for google-news-feed 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for google-news-feed 1.1.0
File Size Uploaded Provenance Actions
google_news_feed-1.1.0.tar.gz 7.1 kB Without provenance Details for google_news_feed-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for google-news-feed 1.1.0
File Interpreter ABI Platform Actions
google_news_feed-1.1.0-py3-none-any.whl Python 3 none any Details for google_news_feed-1.1.0-py3-none-any.whl

Total release size: 12.9 kB

Release files / google_news_feed-1.1.0.tar.gz

Download URL google_news_feed-1.1.0.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
7d410faa62b019ec3ba02d50afe202432275c2f02d6bf30d53611cd9510fa415
BLAKE2b-256 checksum
How to use checksums
251ae688e45aaab206b70547d8d8864a4e8382ed14854998941d6ba85ac16072
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release files / google_news_feed-1.1.0-py3-none-any.whl

Download URL google_news_feed-1.1.0-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
add53b554b7f65a9d07936b714527e9711d30ec1bd3f903e611ba69ad8ec3add
BLAKE2b-256 checksum
How to use checksums
c5fc4780664bcfaf258a89357947e86cbe8c261c247be40463a248412c273e45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Security for google-news-feed 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.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page