Skip to main content

Google News API Python Client

PyPI Downloads Python Version PyPI Version

Unofficial Python client for Google News RSS. Search trusted publishers, run batch research, fetch top stories, decode article URLs, and use the same tools from async code, the command line, or an MCP server.

This package is not an official Google API. It uses Google News RSS feeds by default and offers optional SearchAPI-backed modes when you need provider URLs or richer snippets.

Install

pip install google-news-api

Quickstart

from google_news_api import GoogleNewsClient

with GoogleNewsClient(language="en", country="US") as client:
    articles = client.search("artificial intelligence", when="24h", max_results=5)

for article in articles:
    print(article["title"])
    print(article["source"])
    print(article["published"])
    print(article["link"])

Command Line

The package also installs a google-news command for quick searches and exports:

google-news search "artificial intelligence" --when 24h --max-results 5

Limit results to trusted publishers and exclude unwanted domains:

google-news search "artificial intelligence" \
  --include-domain reuters.com \
  --include-domain apnews.com \
  --exclude-domain youtube.com \
  --when 7d

Run several research queries with the same filters:

google-news batch "AI regulation" "semiconductor supply chain" \
  --include-domain reuters.com \
  --format json

Export machine-readable results as JSON or CSV:

google-news search "python" --format json
google-news top --topic TECHNOLOGY --max-results 10 --format csv

Decode Google News RSS links to publisher URLs when exporting:

google-news search "climate change" --when 7d --decode-links --format json

Use the same SearchAPI modes as the Python client:

google-news search "artificial intelligence regulation" \
  --mode searchapi_light \
  --format json

What You Get

Capability Support
Google News search Keyword search through Google News RSS
Top stories Topic feeds for world, nation, business, technology, sports, science, health, and entertainment
Date filters after, before, and relative when filters
Domain filters Include trusted publishers or exclude unwanted domains
Sync and async clients GoogleNewsClient and AsyncGoogleNewsClient
URL decoding Decode Google News RSS article links to publisher URLs
Batch search Search several queries with shared filters
SearchAPI modes Optional direct publisher URLs and richer snippets
CLI exports Table, JSON, and CSV output from the google-news command
MCP server google-news-mcp for agent and AI tool workflows

Article Results

Default Google News RSS results use this shape:

{
    "title": "Article title",
    "link": "https://news.google.com/rss/articles/...",
    "published": "Tue, 16 Jun 2026 12:00:00 GMT",
    "summary": "Article summary",
    "source": "Publisher name",
    "id": "Google News article ID",
}

Notes:

  • In default mode, link is the Google News RSS article URL.
  • In SearchAPI modes, link is usually the provider or publisher URL returned by SearchAPI.
  • id is always present in normalized results. It is a Google News article ID when available, and None when the provider does not return one.

Common Usage

Top News

from google_news_api import GoogleNewsClient

with GoogleNewsClient(country="US", language="en") as client:
    articles = client.top_news(topic="TECHNOLOGY", max_results=10)

Search With Time Filters

with GoogleNewsClient() as client:
    recent = client.search("climate change", when="24h", max_results=10)
    dated = client.search(
        "Ukraine war",
        after="2024-01-01",
        before="2024-03-01",
        max_results=10,
    )

Use when for relative time filters such as "1h", "24h", or "7d". Use after and before for YYYY-MM-DD date range searches. when cannot be combined with after or before.

Search Trusted Domains

with GoogleNewsClient() as client:
    articles = client.search(
        "artificial intelligence",
        include_domains=["reuters.com", "apnews.com"],
        exclude_domains=["youtube.com"],
        when="7d",
    )

Domain filters are optional and work with search() and batch_search() on both synchronous and asynchronous clients. Existing query strings and result dictionaries are unchanged.

Decode Google News URLs

with GoogleNewsClient() as client:
    article = client.search("python", max_results=1)[0]
    publisher_url = client.decode_url(article["link"])

Async Client

import asyncio

from google_news_api import AsyncGoogleNewsClient


async def main():
    async with AsyncGoogleNewsClient() as client:
        articles = await client.search("machine learning", when="7d", max_results=5)
        urls = await client.decode_urls([article["link"] for article in articles])
        return urls


asyncio.run(main())

Search Modes

The search(), batch_search(), and top_news() methods support these modes:

Mode Backend Use When
"default" Google News RSS You want fast Google News RSS results with no API key
"searchapi_portal" SearchAPI Google News Portal You want direct publisher URLs
"searchapi_light" SearchAPI Google News Light You want recent results and snippets from SearchAPI

SearchAPI modes require an API key:

export SEARCHAPI_API_KEY="your-api-key"

PowerShell:

$env:SEARCHAPI_API_KEY = "your-api-key"
with GoogleNewsClient(language="en", country="US") as client:
    articles = client.search(
        "artificial intelligence regulation",
        max_results=10,
        mode="searchapi_light",
    )

Use "default" first unless you specifically need SearchAPI data.

MCP Server

Install optional MCP dependencies on Python 3.10 or newer:

pip install "google-news-api[mcp]"

Run the packaged stdio server:

google-news-mcp

The packaged entrypoints are the google-news-mcp command and the google_news_api.mcp_server module. The source-tree mcp_server/googlenews.py script remains as a local development compatibility wrapper.

The MCP server exposes news_search, batch_news_search, and top_news. By default, the tools decode Google News links to publisher URLs, store the original URL in google_link, and extract article text when possible. The tools also accept mode for the same search modes as the Python client.

For faster headline-only calls:

result = await client.news_search(
    query="artificial intelligence",
    when="24h",
    max_results=10,
    decode_links=False,
    extract_text=False,
)

MCP tools accept the same search modes as the Python client. See mcp_server/README.md for tool parameters and response format.

Configuration

Parameter Description Default Examples
language ISO 639-1 language code or language-country code "en" "en", "fr", "en-US"
country ISO 3166-1 alpha-2 country code "US" "US", "GB", "DE"
requests_per_minute Client-side request rate limit 60 30, 100
cache_ttl In-memory cache TTL in seconds 300 600, 1800

Available topics:

  • "WORLD"
  • "NATION"
  • "BUSINESS"
  • "TECHNOLOGY"
  • "ENTERTAINMENT"
  • "SPORTS"
  • "SCIENCE"
  • "HEALTH"

Errors

from google_news_api.exceptions import (
    ConfigurationError,
    HTTPError,
    ParsingError,
    RateLimitError,
    ValidationError,
)

The client raises specific exceptions for invalid configuration, invalid query parameters, HTTP failures, rate limits, and feed parsing failures.

Development

git clone https://github.com/ma2za/google-news-api.git
cd google-news-api
poetry install --with dev
pre-commit install

Run the same checks as the GitHub Actions workflow before opening a pull request:

poetry run black --check google_news_api tests examples mcp_server
poetry run isort --check-only google_news_api tests examples mcp_server
poetry run flake8 google_news_api tests examples mcp_server
poetry run pytest

The default test command skips tests that make live network calls. To include live Google News integration tests:

poetry run pytest --run-integration

Contributing

  1. Fork the repository.
  2. Create a branch.
  3. Make the smallest useful change.
  4. Run the same checks as CI.
  5. Open a pull request with the behavior change and test coverage clearly described.

Support The Project

If this Google News API Python client saves you time, consider sponsoring the project:

Sponsor ma2za on GitHub

Stars, bug reports, and focused pull requests also help maintain the project.

License

MIT License. See LICENSE.

Acknowledgments

URL decoding is based on the work of SSujitX/google-news-url-decoder.

Download files

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

Source Distribution

google_news_api-0.0.13.tar.gz (26.0 kB view details)

Uploaded Source

Built Distribution

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

google_news_api-0.0.13-py3-none-any.whl (27.1 kB view details)

Uploaded Python 3

File details

Details for the file google_news_api-0.0.13.tar.gz.

File metadata

  • Download URL: google_news_api-0.0.13.tar.gz
  • Upload date:
  • Size: 26.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for google_news_api-0.0.13.tar.gz
Algorithm Hash digest
SHA256 a47d96d53dc2f4e87896ae171b14f490959d4dc020599c27c8d3a81b32acf054
MD5 dc5d6d3ede7e286e173986bef7fffd93
BLAKE2b-256 35fad78e9f01cc3bdb3a181154d135483bb1dff3fae51f982bf2cadd5d6f4156

See more details on using hashes here.

Provenance

The following attestation bundles were made for google_news_api-0.0.13.tar.gz:

Publisher: ci_publish.yml on ma2za/google-news-api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file google_news_api-0.0.13-py3-none-any.whl.

File metadata

File hashes

Hashes for google_news_api-0.0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 afe6d0a615bc66e48131a5aa88da1069f96657150e8ccbbca83bf7420744de30
MD5 c59ba9b4c4a224e2e6fb1f7d79808cdd
BLAKE2b-256 af898776b8995c83fa1800b7e282178ebcca9a7212bde2fbd5c737d8febd2965

See more details on using hashes here.

Provenance

The following attestation bundles were made for google_news_api-0.0.13-py3-none-any.whl:

Publisher: ci_publish.yml on ma2za/google-news-api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.0.17

2 files

0.0.16

2 files

0.0.15

2 files

0.0.14

2 files

This release

0.0.13 This release

2 files

0.0.12

2 files

0.0.11

2 files

0.0.10

2 files

0.0.9

2 files

0.0.8

2 files

0.0.7

2 files

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

Supported by

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