Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 0.2.1 instead.
Reason given by maintainers: mistakenly

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 1.0.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 googlenewsdecoder 1.0.0
File Size Uploaded
googlenewsdecoder-1.0.0.tar.gz 8.1 kB Details

Built distribution (wheel)

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

Total release size: 19.8 kB

Release files / googlenewsdecoder-1.0.0.tar.gz

Download URL googlenewsdecoder-1.0.0.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
41bedc95040db8d3abff6ebd13caf3015baa65d12878a63f16d72191850782a0
BLAKE2b-256 checksum
How to use checksums
04089eda7e6231f6d2cbd83b89e5fef84f0efe11d23a6eeef5201e133effdf14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","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-1.0.0-py3-none-any.whl

Download URL googlenewsdecoder-1.0.0-py3-none-any.whl
Size 11.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4c7f927485438728e8cdbf11d71ed0913a1086b9e7c3a1e710f6f6b1ed39be63
BLAKE2b-256 checksum
How to use checksums
77940d0e5d6188976f2619ffcc2016548df6bd6de6e8343a009ebf3562940a74
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","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 history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.2.1

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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