Skip to main content

PyPI version Python >=3.11 Downloads Downloads this week

Google News URL Decoder

Google News Decoder

Google News Decoder is a Python package that can decode Google News links or Google News URLs to their original URLs. It is a simple tool that saves you time and effort. If you find it useful, please support the package by hitting the star on GitHub. Your support helps keep the project going!

Use googlenewsdecoder to decode a Google News URL, extract the original article URL from news.google.com/read/, /articles/, or Google News RSS /rss/articles/ feeds, and resolve the Google News redirect to the publisher source. Works with pip install googlenewsdecoder or uv add googlenewsdecoder on Python 3.11+.

Looking for a sponsor

ssujitxx@gmail.com

Demo

Decode a Google News URL to the original article URL

How it works

Google News wraps every story in an encoded link. After 2024 that id is opaque — it is not a base64 publisher URL.

This package fetches the per-article signature from Google News, then resolves the original URL with one batchexecute POST. Pass a list and those signatures share that single POST (no for-loop of POSTs).

Accepted input:

  • https://news.google.com/read/...
  • https://news.google.com/articles/...
  • https://news.google.com/rss/articles/...

Each result is {"success": True, "decoded_url": "..."} or {"success": False, "message": "..."}.

Installation

uv add googlenewsdecoder
pip install googlenewsdecoder
pip install googlenewsdecoder --upgrade

This repo uses uv:

uv sync --group dev

Parameters

Parameter Default What it is
source_url required One Google News URL, or a list of them.
interval None Seconds to wait after each article-page fetch. Use on large batches if you hit HTTP 429.
proxy None Optional HTTP/HTTPS/SOCKS5 proxy if this IP is rate-limited.
timeout 10.0 Seconds per HTTP call. None waits indefinitely.
concurrency 8 Async list only. Max parallel article-page fetches.

proxy stays None unless you need one. Examples:

http://user:pass@host:port
https://host:port
socks5://user:pass@host:port

Usage

Sync — gnewsdecoder

from googlenewsdecoder import gnewsdecoder


def main():
    interval_time = 1  # optional; None means no wait
    timeout = 15.0
    # Optional. Examples:
    #   proxy = "http://user:pass@host:port"
    #   proxy = "https://host:port"
    #   proxy = "socks5://user:pass@host:port"
    proxy = None

    source_url = "https://news.google.com/read/CBMi2AFBVV95cUxPd1ZCc1loODVVNHpnbFFTVHFkTG94eWh1NWhTeE9yT1RyNTRXMVV2S1VIUFM3ZlVkVjl6UHh3RkJ0bXdaTVRlcHBjMWFWTkhvZWVuM3pBMEtEdlllRDBveGdIUm9GUnJ4ajd1YWR5cWs3VFA5V2dsZnY1RDZhVDdORHRSSE9EalF2TndWdlh4bkJOWU5UMTdIV2RCc285Q2p3MFA4WnpodUNqN1RNREMwa3d5T2ZHS0JlX0MySGZLc01kWDNtUEkzemtkbWhTZXdQTmdfU1JJaXY?hl=en-US&gl=US&ceid=US%3Aen"

    try:
        result = gnewsdecoder(
            source_url,
            interval=interval_time,
            proxy=proxy,
            timeout=timeout,
        )
        if result["success"]:
            print("Decoded URL:", result["decoded_url"])
        else:
            print("Error:", result["message"])
    except Exception as e:
        print(f"Error occurred: {e}")


if __name__ == "__main__":
    main()

Async — gnews_decoder_async

import asyncio

from googlenewsdecoder import gnews_decoder_async


def main():
    interval_time = 1  # optional; None means no wait
    timeout = 15.0
    # Optional. Examples:
    #   proxy = "http://user:pass@host:port"
    #   proxy = "https://host:port"
    #   proxy = "socks5://user:pass@host:port"
    proxy = None

    source_url = "https://news.google.com/read/CBMi2AFBVV95cUxPd1ZCc1loODVVNHpnbFFTVHFkTG94eWh1NWhTeE9yT1RyNTRXMVV2S1VIUFM3ZlVkVjl6UHh3RkJ0bXdaTVRlcHBjMWFWTkhvZWVuM3pBMEtEdlllRDBveGdIUm9GUnJ4ajd1YWR5cWs3VFA5V2dsZnY1RDZhVDdORHRSSE9EalF2TndWdlh4bkJOWU5UMTdIV2RCc285Q2p3MFA4WnpodUNqN1RNREMwa3d5T2ZHS0JlX0MySGZLc01kWDNtUEkzemtkbWhTZXdQTmdfU1JJaXY?hl=en-US&gl=US&ceid=US%3Aen"

    try:
        result = asyncio.run(
            gnews_decoder_async(
                source_url,
                interval=interval_time,
                proxy=proxy,
                timeout=timeout,
            )
        )
        if result["success"]:
            print("Decoded URL:", result["decoded_url"])
        else:
            print("Error:", result["message"])
    except Exception as e:
        print(f"Error occurred: {e}")


if __name__ == "__main__":
    main()

Async batch

Pass a list. Article pages can run in parallel; decode is still one POST.

import asyncio

from googlenewsdecoder import gnews_decoder_async


def main():
    interval_time = 1  # optional; None means no wait
    timeout = 15.0
    # Optional. Examples:
    #   proxy = "http://user:pass@host:port"
    #   proxy = "https://host:port"
    #   proxy = "socks5://user:pass@host:port"
    proxy = None

    source_urls = [
        "https://news.google.com/read/CBMi2AFBVV95cUxPd1ZCc1loODVVNHpnbFFTVHFkTG94eWh1NWhTeE9yT1RyNTRXMVV2S1VIUFM3ZlVkVjl6UHh3RkJ0bXdaTVRlcHBjMWFWTkhvZWVuM3pBMEtEdlllRDBveGdIUm9GUnJ4ajd1YWR5cWs3VFA5V2dsZnY1RDZhVDdORHRSSE9EalF2TndWdlh4bkJOWU5UMTdIV2RCc285Q2p3MFA4WnpodUNqN1RNREMwa3d5T2ZHS0JlX0MySGZLc01kWDNtUEkzemtkbWhTZXdQTmdfU1JJaXY?hl=en-US&gl=US&ceid=US%3Aen",
        "https://news.google.com/rss/articles/CBMiiAFBVV95cUxQOXZLdC1hSzFqQVVLWGJVZzlPaDYyNjdWTURScV9BbVp0SWhFNzZpSWZxSzdhc0tKbVlHMU13NmZVOFdidFFkajZPTm9SRnlZMWFRZ01CVHh0dXU0TjNVMUxZNk9Ibk5DV3hrYlRiZ20zYkIzSFhMQVVpcTFPc00xQjhhcGV1aXM?hl=en-US&gl=US&ceid=US%3Aen",
    ]

    try:
        results = asyncio.run(
            gnews_decoder_async(
                source_urls,
                interval=interval_time,
                proxy=proxy,
                timeout=timeout,
            )
        )
        for result in results:
            if result["success"]:
                print("Decoded URL:", result["decoded_url"])
            else:
                print("Error:", result["message"])
    except Exception as e:
        print(f"Error occurred: {e}")


if __name__ == "__main__":
    main()

gnewsdecoder(source_urls) also accepts a list (sync fetch, one POST). For many URLs, async batch is the better call.

Credits

Star History

Star History Chart

Visitors

Metadata

Release files for googlenewsdecoder 0.2.2

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

Source distribution (sdist)

Source distribution for googlenewsdecoder 0.2.2
File Size Uploaded Provenance Actions
googlenewsdecoder-0.2.2.tar.gz 8.5 kB Without provenance Details for googlenewsdecoder-0.2.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for googlenewsdecoder 0.2.2
File Interpreter ABI Platform Actions
googlenewsdecoder-0.2.2-py3-none-any.whl Python 3 none any Details for googlenewsdecoder-0.2.2-py3-none-any.whl

Total release size: 20.2 kB

Release files / googlenewsdecoder-0.2.2.tar.gz

Download URL googlenewsdecoder-0.2.2.tar.gz
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
fadbe60969a9dca95a2f9827e7c1e7876c55d845d40b380c1d1bbdfee6b37a41
BLAKE2b-256 checksum
How to use checksums
20ef8a76d015c72d889a43f39724d2cb25ebc3af9d96fa76e4cf43c2102a5e19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / googlenewsdecoder-0.2.2-py3-none-any.whl

Download URL googlenewsdecoder-0.2.2-py3-none-any.whl
Size 11.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c19bc508cb64d7e93ca605b83524e4f6f673532db80aceb6b036d7218af03757
BLAKE2b-256 checksum
How to use checksums
cdacd356a72343fcdf3cccb83807e52c1610cb12052d47561ca784645b986175
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for googlenewsdecoder 0.2.2

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.

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