Skip to main content
Question

Can't retrieve Google News RSS feeds

  • July 17, 2026
  • 3 replies
  • 31 views

I have tried for about three weeks to get zap to pull local news (Both with a NewsAPI and without-Google).  Neither has succeeded.  I have exhausted all my options with builds and rebuilds.  Had Copilot test it to 100% accuracy (Continues to find errors each time) fixes them but still does not work.  Rechecks finds another problem….  Simple request:  Pull links from past 24 hours reference to Metro DC Area Fire and Police Articles and any Chick-fil-A Related Articles worldwide.  Email that to my email address at 8 AM.  

 

Why can I not get this to work?  ignore the time of 3:15 (trying to get it to work)

 

/**
* @param {{inputData: InputData}}
*/
export default async function main({inputData}) {
const feeds = [
{
name: 'Chick-fil-A Worldwide',
url: 'https://news.google.com/rss/search?q=Chick-fil-A%20when:1d&hl=en-US&gl=US&ceid=US:en',
},
{
name: 'DC Metro Police Fire Incidents',
url: 'https://news.google.com/rss/search?q=(police%20OR%20fire%20OR%20firefighters%20OR%20shooting%20OR%20arrest%20OR%20crash)%20(%22Washington%20DC%22%20OR%20%22Fairfax%20County%22%20OR%20Arlington%20OR%20Alexandria%20OR%20%22Montgomery%20County%22%20OR%20%22Prince%20George%27s%20County%22%20OR%20%22Loudoun%20County%22)%20when:1d&hl=en-US&gl=US&ceid=US:en',
},
];

const results = [];
let totalArticles = 0;
const errors = [];

// Fetch and parse each feed
for (const feed of feeds) {
try {
const response = await fetch(feed.url);

if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
}

const xml = await response.text();

// Extract all <item> blocks using regex
const itemRegex = /<item>[\s\S]*?<\/item>/g;
const items = [];
let match;

while ((match = itemRegex.exec(xml)) !== null) {
const itemContent = match[1];

// Extract title, link, and pubDate using regex
const titleMatch = itemContent.match(/<title>[\s\S]*?<\/title>/);
const linkMatch = itemContent.match(/<link>[\s\S]*?<\/link>/);
const pubDateMatch = itemContent.match(/<pubDate>[\s\S]*?<\/pubDate>/);

items.push({
title: titleMatch ? titleMatch[1].trim() : 'N/A',
link: linkMatch ? linkMatch[1].trim() : 'N/A',
pubDate: pubDateMatch ? pubDateMatch[1].trim() : 'N/A',
});
}

results.push({
feedName: feed.name,
articles: items,
count: items.length,
});

totalArticles += items.length;
} catch (error) {
const errorMsg = `${feed.name}: ${error.message}`;
errors.push(errorMsg);
}
}

// Build the email body from results
let body = '';
if (results.length > 0) {
body = results
.map((feed) => {
let feedBody = `\n${feed.feedName} (${feed.count} articles):\n`;
feedBody += feed.articles
.map((article) => `- ${article.title}\n Link: ${article.link}\n Published: ${article.pubDate}`)
.join('\n');
return feedBody;
})
.join('\n');
}

// Append error messages if any feeds failed
if (errors.length > 0) {
body += `\n\nErrors encountered:\n${errors.join('\n')}`;
}

// Ensure output always has subject, body, and totalArticles for email step
return {
subject: `News Digest: ${totalArticles} articles from ${results.length} feed(s)`,
body: body || 'No articles found or all feeds failed to fetch.',
totalArticles: totalArticles,
feedResults: results,
errors: errors,
};
}

3 replies

SamB
Community Manager
Forum|alt.badge.img+11
  • Community Manager
  • July 20, 2026

Hi ​@Larry1494, welcome to the Community! 😁

Instead of fetching and parsing the feed XML using a Code step, have you tried using the RSS by Zapier app for this? It can monitor multiple RSS feeds but since it would trigger your Zap when new items are published rather than fetching them once a day, you’d likely want to compile the feed items into a daily digest.

To do that you could set up a separate Zap for each RSS feed you want to monitor, or use a single Zap with the New Items in Multiple Feeds trigger (check out our Trigger Zap workflows from new RSS feed items guide for details). Then, you’d have the Zap add the new items into a digest that gets emailed to you every day at 8am. If you’ve not worked with Digest by Zapier before you can learn more about it here: Compile data in a digest in Zap workflows.

Do you think that could work?


  • Author
  • Beginner
  • July 20, 2026

Thank you. I will attempt this.  


SamB
Community Manager
Forum|alt.badge.img+11
  • Community Manager
  • July 21, 2026

Keep us posted on how it goes ​@Larry1494! Happy to lend a hand if you get stuck when setting it up. 🙂