Skip to content

Instantly share code, notes, and snippets.

@YonLiud
Created March 21, 2026 14:27
Show Gist options
  • Select an option

  • Save YonLiud/aeec70a353a860cd4546de910221c5bc to your computer and use it in GitHub Desktop.

Select an option

Save YonLiud/aeec70a353a860cd4546de910221c5bc to your computer and use it in GitHub Desktop.
n8n Code node that parses multiple Google News RSS feeds into per-ticker title arrays, with configurable time-based filtering.
const HOURS_BACK = 12; // Hours back filter
const cutoff = new Date(Date.now() - HOURS_BACK * 60 * 60 * 1000);
const result = {};
for (const item of $input.all()) {
const channel = item.json.rss.channel;
const titleMatch = channel.title.match(/"(\w+) stock"/i);
if (!titleMatch) continue;
const ticker = titleMatch[1].toUpperCase();
const items = Array.isArray(channel.item) ? channel.item : [channel.item];
const titles = items
.filter(i => {
const pubDate = new Date(i.pubDate);
return pubDate >= cutoff;
})
.map(i => i.title.replace(/<[^>]*>/g, '').trim());
if (titles.length > 0) {
result[ticker] = titles;
}
}
return Object.entries(result).map(([ticker, titles]) => ({
json: { ticker, titles }
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment