Skip to main content

Search Google News RSS Feed and returns a usable JSON response

Project description

GNews Travis branch Coveralls branch

🚩 A Python Package (with CLI support) that searches Google News RSS Feed and returns a usable JSON response
🚩 As well as you can fetch full article

Usage

Coverts ⬇️

{'publisher': 'Aljazeera.com',
 'description': 'Pakistan accuses India of stoking conflict in Indian Ocean  '
                'Aljazeera.com',
 'published date': 'Tue, 16 Feb 2021 11:50:43 GMT',
 'title': 'Pakistan accuses India of stoking conflict in Indian Ocean - '
          'Aljazeera.com',
 'url': 'https://www.aljazeera.com/news/2021/2/16/pakistan-accuses-india-of-nuclearizing-indian-ocean'}

Install

pip install gnews

Usage

from GNews import GNews
google_news = GNews()
news = google_news.get_news('Pakistan')

We can set country, language, period and size during initialization

google_news = GNews(language='en', country='US', period='7d', size=10)

On the bottom left side of the Google News page you may find a Language & region section where you can find all of the supported combinations.

Getting full article

you can use newspaper3k to scrap full article, you can also get full article using get_full_article by passing url.

make sure you already install newspaper3k

pip3 install newspaper3k

from GNews import GNews
google_news = GNews()
news = google_news.get_news('Pakistan')
article = google_news.get_full_article(news[0]['url'])
article.title 

IMF Staff and Pakistan Reach Staff-Level Agreement on the Pending Reviews Under the Extended Fund Facility'

article.text 

End-of-Mission press releases include statements of IMF staff teams that convey preliminary findings after a mission. The views expressed are those of the IMF staff and do not necessarily represent the views of the IMF’s Executive Board.\n\nIMF staff and the Pakistani authorities have reached an agreement on a package of measures to complete second to fifth reviews of the authorities’ reform program supported by the IMF Extended Fund Facility (EFF) ..... (full article)

article.images

{'https://www.imf.org/~/media/Images/IMF/Live-Page/imf-live-rgb-h.ashx?la=en', 'https://www.imf.org/-/media/Images/IMF/Data/imf-logo-eng-sep2019-update.ashx', 'https://www.imf.org/-/media/Images/IMF/Data/imf-seal-shadow-sep2019-update.ashx', 'https://www.imf.org/-/media/Images/IMF/Social/TW-Thumb/twitter-seal.ashx', 'https://www.imf.org/assets/imf/images/footer/IMF_seal.png'}

article.authors

[]

Read full documentation for newspaper3k newspaper3k

Article Properties

Properties Description Example
title Title of the article IMF Staff and Pakistan Reach Staff-Level Agreement on the Pending Reviews Under the Extended Fund Facility
url Google news link to article Article Link
published date Published date Wed, 07 Jun 2017 07:01:30 GMT
description Short description of article IMF Staff and Pakistan Reach Staff-Level Agreement on the Pending Reviews Under the Extended Fund Facility ...
publisher Publisher of article The Guardian

License

MIT ©

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gnews-0.0.2.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gnews-0.0.2-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file gnews-0.0.2.tar.gz.

File metadata

  • Download URL: gnews-0.0.2.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.1

File hashes

Hashes for gnews-0.0.2.tar.gz
Algorithm Hash digest
SHA256 8336f13c94a0d460b3b0301af377254717538d61819ef0cce35b8b480987564c
MD5 0725a1ff09bf2b8573069d83a36ef700
BLAKE2b-256 658c7b57960f42dd57ab1862c70985cb628d9c33a8f613feb8a43f8d096cb22b

See more details on using hashes here.

File details

Details for the file gnews-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: gnews-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.1

File hashes

Hashes for gnews-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 01c16cedca953407a56cf95c7796df39ead3916990a484e1609126714ed9369c
MD5 1d76b0357549fba68d5e2d05b125b868
BLAKE2b-256 c4a568a0561cae89122a0439fe12928143c2ca1f82d520acb0d3075df8411fac

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page