GoogleNewsDecoder

raw JSON →
0.1.7 verified Mon Apr 27 auth: no python

A Python package to decode Google News URLs (https://news.google.com/articles/...) to their original source URLs. Current version 0.1.7, released Jan 2025. Active development with frequent updates.

pip install googlenewsdecoder
error ImportError: cannot import name 'decoderv1' from 'googlenewsdecoder'
cause decoderv1 was removed in version 0.1.5.
fix
Use 'from googlenewsdecoder import new_decoderv1' instead.
error AttributeError: 'NoneType' object has no attribute 'get'
cause The function returned None instead of a dict (e.g., due to network error or invalid URL).
fix
Check that the URL is a valid Google News article URL and handle None return: decoded = new_decoderv1(url) or {}.
error HTTP 429 Too Many Requests
cause Too many rapid requests to Google News servers.
fix
Use the proxy parameter (new in 0.1.7) or add time.sleep() between calls.
breaking As of version 0.1.5, old decoder methods (decoderv1, decoderv2, decoderv3, decoderv4) are deprecated and no longer functional. Use new_decoderv1 instead.
fix Replace calls to decoderv1/2/3/4 with new_decoderv1.
gotcha Google News URL structure changes frequently; decoding may fail silently. The function may return {'status': 'error', 'message': '...'} instead of raising an exception.
fix Always check the 'status' key in the returned dict before using 'decoded_url'.
gotcha Rate limiting (HTTP 429) is common. From version 0.1.6, a time delay between requests was added, but heavy usage may still be blocked.
fix Use proxy support via the 'proxy' parameter (added in 0.1.7) or add your own delays.

Decode a Google News article URL to its original source. Returns dict with 'decoded_url' key.

from googlenewsdecoder import new_decoderv1

# Example Google News URL (decode to original source)
decoded = new_decoderv1('https://news.google.com/articles/CAIiEP0wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZz4wZiIsInNvdXJjZSI6IiJ9')
print(decoded.get('decoded_url'))