Skip to main content

Python client for Google News feed.

Project description

PyPI license

gnfetcher

An easy-to-use python client for Google News feeds.

gnfetcher supports Python 2 as well as Python 3.

Installation

To install gnfetcher, simply,

$ pip install gnfetcher

To install and use gnfetcher CLI, follow instructions here CLI

Filters

Google News feeds use 3 basic filters:

  • Edition Limits results to a specific edition. There are more than 70 regional editions of Google News in many different languages. Each edition is specifically tailored with news for that audience.

  • Topic Limits results to a specific topic. There are several custom topics like sports, business, world, health, science, politics, etc.

  • Location Limits results to a specific location.

Other than these, you can also specify:

  • Language Provides results in specified language. 60+ languages are supported.

  • Query Provide results according to a specific query.

Usage

  • Create a gnfetcher object:

    >>> from gnfetcher import gnfetcher
    >>> client = gnfetcher()
  • Get current parameter settings

    >>> client.get_config()
    {'edition': 'United States (English)',
     'language': 'english',
     'loaction': None,
     'query': None,
     'topic': 'top stories'}
  • Get news feed

    >>> client.get_news()
    [{'img': 'https://t1.gstatic.com/images?q=tbn:ANd9GcQ5KFdYdQclmxUdvdV2zYQ_hO7JMrG2864ZDdN9A3GxORmTf_issciogLEEZmA5QIFfRQsyYDlm',
      'link': 'https://www.washingtonpost.com/world/french-citizens-vote-in-an-uncertain-race-that-could-determine-europes-future/2017/04/23/fd3759ce-1fa4-11e7-bb59-a74ccaf1d02f_story.html',
      'title': "French citizens vote in an uncertain race that could determine Europe's future - Washington Post"},
     {'img': 'https://t0.gstatic.com/images?q=tbn:ANd9GcTfosRmEfpoH40YiX5dyEIgL5rw-OSgcsKGEYhIm15f-OVQmWoidnH5NZD6P1vwaZfpQ33Xt8tZ',
      'link': 'https://www.washingtonpost.com/national/health-science/big-turnout-expected-for-march-for-science-in-dc/2017/04/21/67cf7f90-237f-11e7-bb9d-8cd6118e1409_story.html',
      'title': "Why people are marching for science: 'There is no Planet B' - Washington Post"},
     {'img': 'https://t2.gstatic.com/images?q=tbn:ANd9GcRw4xGtSrL5ZCpDkp5QHLUBPLgDNCsFFpgjJeOdD2q4w4giPDsDf9G3NOAZeNYWOf8f5V1aYTLu',
      'link': 'https://www.washingtonpost.com/politics/nearing-100-days-trumps-approval-at-record-lows-but-his-base-is-holding/2017/04/22/a513a466-26b4-11e7-b503-9d616bd5a305_story.html',
      'title': "Nearing 100 days, Trump's approval at record lows but his base is holding - Washington Post"}
    ]
  • Changing paramteres

    >>> client.edition = 'India (Hindi)'
    >>> client.topic = 'sports'
    >>> client.language = 'hindi'
    >>> client.get_news()
    [{'img': 'https://t0.gstatic.com/images?q=tbn:ANd9GcTSo3cJx_-NKmtcsAaB8ZNC6tVF-FzU7FxLMmT9GwETYw-h_XmgzE_Ux2Bz3e2dk_iRUsaCIwbY',
      'link': 'http://aajtak.intoday.in/sports/story/ms-dhoni-is-the-captain-of-shane-warnes-all-time-ipl-eleven-1-925107.html',
      'title': 'वॉर्न की IPL टीम में भारतीयों का बोलबाला, धोनी को सौंपी कप्तानी - आज तक'},
     {'img': 'https://t1.gstatic.com/images?q=tbn:ANd9GcTlK3tT02bbryKfJS_l-fbICNHDUFsaXktMQSnvg_Pi-TWMBknuvBL3OhViOGzhjOcMtig4pg3t',
      'link': 'http://www.patrika.com/news/kanpur/jwala-gutta-says-up-government-should-make-strategy-for-better-sports-hindi-news-1560241/',
      'title': 'प्यार का करारनामा, इंटरनेशनल बैडमिंटन प्लेयर ज्वाला गुट्टा के हाथ पर नजर आया! - Patrika'}
    ]
  • Get news by query

    >>> client.query = 'cricket'
    >>> client.get_news()
    [{'img': 'https://t2.gstatic.com/images?q=tbn:ANd9GcTQ6zOoooNhFaXM7bdl2WmmuJkHdE5ED26Mp2QtaRyKELMlBuvc62LmDVgt7-D3m7mgIPGI4vXf',
      'link': 'http://www.espncricinfo.com/west-indies-v-pakistan-2017/content/story/1094080.html',
      'title': 'West Indies v Pakistan, 1st Test, Kingston, 2nd day April 22, 2017 - ESPNcricinfo.com'},
     {'img': 'https://t1.gstatic.com/images?q=tbn:ANd9GcRePCUSgV_AXDrzSe59DsO7j6tgdcfWWocnusHc4OtLxNtGNloVuh_HPA1BtibucOTO9r-qwtNL',
      'link': 'https://thefield.scroll.in/835391/cricket-china-bowled-out-for-28-in-world-league-qualifier',
      'title': 'Cricket: China bowled out for 28 in World League qualifier - Scroll.in'},
     {'img': 'https://t2.gstatic.com/images?q=tbn:ANd9GcSpVMJHsdo6Q5SxuIzwrBHn7seXis3zwryH5ohRyeLVZj3phQDX1e92HZqW7iODBeJM7mrGf7yH',
      'link': 'http://www.hindustantimes.com/ipl-2017/live-cricket-score-ipl-2017-t20-mumbai-indians-vs-delhi-daredevils-live/story-CLQVOWa9v8ub7clUSz41LN.html',
      'title': 'Full Cricket Score, IPL 2017, T20, Mumbai Indians vs Delhi Daredevils: MI beat DD by 14 runs - Hindustan Times'}
    ]
  • Get news by location

    >>> client.loaction = 'delhi'
    >>> client.get_news()
    [{'img': 'https://t3.gstatic.com/images?q=tbn:ANd9GcQI4mXbCB-bLvuiCqN1BoAyClMWgllzHy8DG9SCNDr3_dH9JpNpgfqTz8UneHeE85jdi0wknyhF',
      'link': 'http://timesofindia.indiatimes.com/city/delhi/cops-wrap-city-in-a-multi-layer-security-blanket/articleshow/58305944.cms',
      'title': 'MCD polls: Cops wrap Delhi in multi-layer security blanket - Times of India'},
     {'img': 'https://t0.gstatic.com/images?q=tbn:ANd9GcTd-gOZQ59kAj-GJ9uEHQ3wbGMF6Y4dI9pkc2B9RI0YyOrBPB4jIljR5zFFRXlB0KjqcuZxkAVl',
      'link': 'http://www.financialexpress.com/india-news/mcd-polls-2017-heritage-not-on-any-partys-agenda/637968/',
      'title': "MCD polls 2017: Heritage not on any party's agenda - Financial Express"},
     {'img': 'https://t1.gstatic.com/images?q=tbn:ANd9GcRK_YvCPtCF1uiA8aKz3LJLPHFP7zAlPHFkotuxL7Jr8DZBnA-w5HfMCe1Q69J7Cpf_AKKsNKeV',
      'link': 'http://timesofindia.indiatimes.com/city/delhi/car-owner-booked-for-kashmere-gate-accident/articleshow/58308236.cms',
      'title': 'Car owner booked for Kashmere Gate accident - Times of India - Times of India'}
    ]
  • Get list of available editions, languages and topics

    >>> client.editions
    ['Germany', 'Poland', 'Morocco', 'Colombia', 'India (Telugu)', 'Australia', 'Hungary', 'India (Malayalam)',
    'United Arab Emirates', 'Lebanon', 'Serbia', 'Canada (English)', 'China', 'United States (English)',
    'Nigeria', 'Austria', 'Kenya', 'Peru', 'Italy', 'Ghana', 'Ukraine (Russian)', 'Belgium (French)', 'Vietnam',
    'South Africa', 'Ethiopia', 'Lithuania', 'Philippines', 'Brazil', 'Saudi Arabia', 'India (Hindi)', 'India (Tamil)',
    'United States (Spanish)', 'Latvia', 'Singapore', 'Norway', 'Sweden', 'Canada (French)', 'Egypt', 'Japan',
    'Arab world', 'Ukraine (Ukranian)', 'Netherlands', 'Hong Kong', 'Romania', 'United Kingdom', 'Slovakia',
    'Czech Republic', 'Chile', 'Indonesia', 'France', 'Bangladesh', 'Taiwan', 'Tanzania', 'Argentina', 'Greece',
    'Mexico', 'Pakistan', 'Bulgaria', 'Senegal', 'Zimbabwe', 'Belgium (Dutch)', 'Uganda', 'Turkey', 'Portugal',
    'Slovenia', 'Namibia', 'Cuba', 'New Zealand', 'Russia', 'India (English)', 'Botswana', 'Venezuela', 'Israel (Hebrew)',
    'Thailand', 'Switzerland', 'Israel (English)', 'Ireland', 'Malaysia']
    >>> client.topics
    ['business', 'politics', 'top stories', 'technology', 'world', 'sports', 'entertainment', 'national']
    >>> client.languages
    ['tamil', 'kannada', 'norwegian', 'swedish', 'bulgarian', 'arabic', 'hindi', 'catalan', 'georgian', 'latvian',
    'albanian', 'japanese', 'english', 'german', 'lithuanian', 'chinese simplified', 'polish', 'czech', 'macedonian',
    'yiddish', 'turkish', 'dutch', 'urdu', 'serbian', 'basque', 'thai', 'hungarian', 'danish', 'galician', 'latin',
    'chinese traditional', 'vietnamese', 'portuguese', 'welsh', 'croatian', 'bengali', 'finnish', 'icelandic',
    'azerbaijani', 'swahili', 'malay', 'korean', 'slovak', 'russian', 'irish', 'spanish', 'belarusian', 'french',
    'estonian', 'indonesian', 'slovenian', 'italian', 'maltese', 'haitian creole', 'esperanto', 'ukrainian',
    'afrikaans', 'filipino', 'gujarati', 'hebrew', 'telugu', 'greek', 'persian', 'romanian']

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

gnfetcher-1.0.1.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

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

gnfetcher-1.0.1-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file gnfetcher-1.0.1.tar.gz.

File metadata

  • Download URL: gnfetcher-1.0.1.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5

File hashes

Hashes for gnfetcher-1.0.1.tar.gz
Algorithm Hash digest
SHA256 f265a2a8eaa7cbc18f1faebf51f309c8c0ea0167d2f58c198ca6ad730d14ac41
MD5 c84f88bb74f83467f331fb3a297d0c16
BLAKE2b-256 a2b7ae06204d7d5c5a71614c74bbfa90b0c5dc2b7a57641f83651afd9895b350

See more details on using hashes here.

File details

Details for the file gnfetcher-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: gnfetcher-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5

File hashes

Hashes for gnfetcher-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 32f5812d11d9ef831e3c5f8a126d6c03ffd8eda67f90bfd53340b2494b158e5e
MD5 1cd512509ac2eca187953c9d5eade0ff
BLAKE2b-256 4cb29f0fe7a5aef0879e49e19ab74e66b36591159e3ff4598429a9af6410a28f

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