Package Information
Documentation
๐ n8n-nodes-google-news-decoder
A powerful n8n custom node that decodes Google News encoded URLs into clean, original article links with built-in caching and advanced configuration options.
๐ Table of Contents
- Overview
- Features
- Prerequisites
- Installation
- Configuration
- Usage
- Example Workflow
- Advanced Features
- Development
- Project Structure
- Testing
- Troubleshooting
- License
๐ฏ Overview
This package provides a custom n8n node that transforms complex Google News RSS encoded URLs into clean, decoded URLs with intelligent caching and customizable decoding parameters.
Before:
https://news.google.com/rss/articles/CBMihAFBVV95cUxNRnMtZDFfUTgx...
After:
https://original-news-site.com/article-title-here
โจ Features
- ๐ URL Decoding - Converts Google News encoded RSS links to original URLs
- ๐พ Smart Caching - Built-in LRU cache (max 1000 items) with configurable TTL
- ๐ Metadata Extraction - Retrieves signature, timestamp, and GUID
- ๐๏ธ Customizable - Configure RPC headers, locales, and endpoints
- ๐ Simple Integration - Works seamlessly with n8n workflows
- ๐ฏ RSS Optimized - Perfect for Google News RSS โ article extraction pipelines
- โก Performance - Sequential processing with error handling and cache support
Output Data
Each decoded URL returns:
{
"guid": "CBMihAFBVV95cUxNRnMtZDFfUTgx...",
"encodedUrl": "https://news.google.com/rss/articles/...",
"decodedUrl": "https://original-news-site.com/article",
"timestamp": "1705334400",
"signature": "CBMiXWh0dHBz...",
"cached": false,
"cacheAge": "0s" // Only present if cached=true
}
๐ฆ Prerequisites
| Requirement | Version |
|---|---|
| Node.js | 18.x or 20.x |
| npm | 8.x or higher |
| n8n | 1.12+ |
| OS | Windows, Linux, macOS |
๐ Installation
Step 1: Install n8n (if needed)
# Install n8n globally
npm install -g n8n
# Start n8n
n8n start
Step 2: Install the Custom Node
Navigate to your n8n configuration folder:
# Windows (typically)
cd C:\Users\<username>\.n8n
# macOS/Linux (typically)
cd ~/.n8n
Create the nodes directory (if not present) and initialize a new Node.js project:
mkdir -p nodes
cd nodes
npm init -y
Install the package:
Option A: From Local Path
npm install /path/to/n8n-nodes-google-news-decoder
Option B: From GitHub
npm install git+https://github.com/ziedkefidev-cell/n8n-nodes-google-news-decoder.git
Option C: From npm (if published)
npm install n8n-nodes-google-news-decoder
Step 3: Restart n8n
n8n start
๐ The node will now appear in n8n under the name "Google News Decoder"
โ๏ธ Configuration
Basic Configuration
| Parameter | Type | Required | Description |
|---|---|---|---|
| Encoded URL | String | Yes | Google News encoded URL to decode |
Advanced Options
๐ง HTML Extraction
| Parameter | Type | Default | Description |
|---|---|---|---|
| Signature Attribute | String | data-n-a-sg |
HTML attribute for signature |
| Timestamp Attribute | String | data-n-a-ts |
HTML attribute for timestamp |
๐ Localization
| Parameter | Type | Default | Description |
|---|---|---|---|
| Locale | String | US:en |
Locale for decode request (e.g., FR:fr) |
๐ API Configuration
| Parameter | Type | Default | Description |
|---|---|---|---|
| Decode Endpoint | String | https://news.google.com/_/DotsSplashUi/data/batchexecute |
Google's internal decoding endpoint |
| RPC Header Base | JSON | ["X", "X", 1, [1, 1, 1], ...] |
Custom RPC header structure |
๐พ Caching
| Parameter | Type | Default | Description |
|---|---|---|---|
| Enable Cache | Boolean | true |
Enable/disable result caching |
| Cache TTL (minutes) | Number | 5 |
Cache time-to-live (shown when enabled) |
Cache Features:
- LRU eviction (max 1000 items)
- Per-URL caching
- Cached responses include
cacheAgefield - Automatic TTL expiration
๐ HTTP Headers
| Header Name | Default Value | Description |
|---|---|---|
| User-Agent | Mozilla/5.0 (Windows NT 10.0; Win64; x64) ... |
Browser user agent |
| Referer | https://www.google.com/ |
HTTP referer header |
Additional custom headers can be added as needed.
๐ก Usage
Basic Example
- Add Google News Decoder node to your workflow
- Configure the Encoded URL field with a Google News link
- Execute the workflow
Input:
https://news.google.com/rss/articles/CBMiXWh0dHBzOi8vd3d3...
Output:
{
"guid": "CBMiXWh0dHBzOi8vd3d3...",
"encodedUrl": "https://news.google.com/rss/articles/CBMi...",
"decodedUrl": "https://techcrunch.com/2024/01/15/ai-story",
"timestamp": "1705334400",
"signature": "CBMiXWh0dHBz...",
"cached": false
}
With Caching Enabled
First Request:
{
"decodedUrl": "https://example.com/article",
"cached": false
}
Subsequent Request (within TTL):
{
"decodedUrl": "https://example.com/article",
"cached": true,
"cacheAge": "45s"
}
๐ Example Workflow
graph LR
A[RSS Feed Node] -->|encoded URLs| B[Google News Decoder]
B -->|clean URLs| C[HTTP Request Node]
C -->|article content| D[Process/Store]
style B fill:#4285F4,color:#fff
Workflow Steps:
- RSS Feed Node - Fetches Google News RSS feed with encoded links
- Google News Decoder Node - Decodes URLs to original article links (with caching)
- HTTP Request Node - Fetches the actual article content
- Processing Node - Parse, store, or analyze the article data
Example Workflow JSON
{
"nodes": [
{
"name": "RSS Feed",
"type": "n8n-nodes-base.rssFeedRead",
"parameters": {
"url": "https://news.google.com/rss/search?q=technology"
}
},
{
"name": "Google News Decoder",
"type": "n8n-nodes-google-news-decoder.googleNewsDecoder",
"parameters": {
"encodedUrl": "={{ $json.link }}",
"advanced": {
"enableCache": true,
"cacheTTL": 10
}
}
},
{
"name": "HTTP Request",
"type": "n8n-nodes-base.httpRequest",
"parameters": {
"url": "={{ $json.decodedUrl }}"
}
}
]
}
๐ Advanced Features
Custom RPC Header Base
If Google changes their API structure, you can update the RPC header base:
["X", "X", 1, [1, 1, 1], 1, 1, null, 0, 0, null, 0]
Format: Must be a valid JSON array matching Google's expected structure.
Custom Locale Configuration
For international Google News sources:
| Locale | Description |
|---|---|
US:en |
United States (English) |
FR:fr |
France (French) |
DE:de |
Germany (German) |
JP:ja |
Japan (Japanese) |
UK:en |
United Kingdom (English) |
Cache Management
How the cache works:
- LRU Eviction: When cache reaches 1000 items, oldest entries are removed
- TTL Expiration: Cached results expire after configured minutes
- Per-URL Keying: Each unique encoded URL has its own cache entry
- In-Memory: Cache is lost on n8n restart (session-based)
Best Practices:
- Enable cache for workflows processing the same URLs repeatedly
- Use shorter TTL (1-5 min) for frequently updated news
- Use longer TTL (30-60 min) for stable article lists
- Disable cache for one-time bulk processing
๐ ๏ธ Development
Clone and Setup
# Clone the repository
git clone https://github.com/<your-username>/n8n-nodes-google-news-decoder.git
# Navigate to directory
cd n8n-nodes-google-news-decoder
# Install dependencies
npm install
# Build the project
npm run build
Build Commands
# Development build
npm run build
# Watch mode (auto-rebuild on changes)
npm run dev
# Clean build artifacts
npm run clean
# Local test (without n8n)
npm run test:local
Implementation Highlights
Core Features:
- โ Sequential item processing with error handling
- โ In-memory LRU cache with TTL
- โ Regex escaping for HTML attribute extraction
- โ Flexible article ID extraction from URL
- โ Configurable RPC header structure
- โ Custom HTTP headers support
- โ Continue-on-fail support
๐งช Testing
Local HTTP Test (without n8n)
Run a standalone test to verify the decoder works:
# Install test dependencies
npm install node-fetch
# Build the project
npm run build
# Run local test
npm run test:local
Expected Output:
๐งช Testing Google News Decoder (Local Mode)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Input URL: https://news.google.com/rss/articles/CBMi...
Decoded URL: https://techcrunch.com/2024/01/15/ai-article
GUID: CBMiXWh0dHBz...
Timestamp: 1705334400
โ
Decode successful!
Testing in n8n
- Create a new workflow
- Add a Manual Trigger node
- Add Google News Decoder node
- Configure with test URL:
https://news.google.com/rss/articles/CBMiXWh0dHBzOi8vd3d3LnRlY2hjcnVuY2guY29tLzIwMjQvMDEvMTUvYWktc3Rvcnkv0gEA - Execute and check output
Test Cache Behavior
- Execute workflow with cache enabled
- Check output:
"cached": false - Execute again within TTL
- Check output:
"cached": true, "cacheAge": "15s"
๐ง Troubleshooting
Node Not Appearing in n8n
Problem: Node doesn't show up in the n8n interface
Solutions:
- Verify installation in
~/.n8n/nodes/node_modules/ls ~/.n8n/nodes/node_modules/n8n-nodes-google-news-decoder - Check
package.jsonhas correctn8nconfiguration - Restart n8n completely
pkill -f n8n n8n start - Check n8n logs for errors
n8n start --loglevel debug
Decoding Errors
Issue: "Could not extract decoding keys from Google News page"
Causes & Solutions:
- โ Google changed HTML structure
- โ
Update
Signature AttributeandTimestamp Attributein Advanced options - โ Inspect a Google News page to find new attribute names
- โ
Update
- โ Invalid encoded URL
- โ
Ensure URL starts with
https://news.google.com/ - โ
URL must contain
/articles/path
- โ
Ensure URL starts with
Issue: "Invalid decode response format"
Causes & Solutions:
- โ Google changed API response structure
- โ
Update
RPC Header Basein Advanced options - โ Check Google's current API format
- โ
Update
- โ Network timeout
- โ Check internet connection
- โ
Verify firewall allows requests to
news.google.com
Issue: "Could not extract article ID"
Causes & Solutions:
- โ Non-standard URL format
- โ
URL must match pattern:
/articles/[ARTICLE_ID] - โ
ARTICLE_ID typically starts with
CB
- โ
URL must match pattern:
Cache Issues
Issue: Cache not working / Always returns "cached": false
Solutions:
- Verify
Enable Cacheis set totruein Advanced options - Check Cache TTL is greater than 0
- Ensure you're using the exact same encoded URL
- Remember cache is lost on n8n restart
Issue: Want to clear cache
Solution:
- Restart n8n (cache is in-memory only)
- Or disable and re-enable cache in node settings
Build Errors
Problem: npm run build fails
Solutions:
# Clean and rebuild
rm -rf dist node_modules package-lock.json
npm install
npm run build
# If TypeScript errors persist
npm install --save-dev typescript@latest
npm run build
โ ๏ธ Important Notes
- ๐ This node relies on Google's internal URL structure and decoding endpoint
- โก Google may change their URL format or API at any time
- ๐ No API key or authentication required (uses public endpoints)
- ๐พ Cache is in-memory and cleared on n8n restart
- ๐ Maximum 1000 cached items (LRU eviction)
- ๐ Works with all Google News country domains
- โ๏ธ Not affiliated with or endorsed by Google
Rate Limiting
While the node itself has no rate limits, Google may rate-limit requests. Recommendations:
- Use caching to reduce API calls
- Add delay between batches (use n8n's Wait node)
- Process items in smaller batches
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Contribution Ideas
- ๐ Add proxy feature
- ๐ Batch processing optimization
๐ฌ Support
If you encounter any issues or have questions:
- ๐ Report a bug
- ๐ฌ Join n8n community
๐ Acknowledgments
- Built for the n8n workflow automation platform
- Inspired by the need for clean, trackable news URLs
- Thanks to the n8n community for feedback and testing
Made with โค๏ธ for the n8n community
โญ Star this repository if you find it helpful!