Back to articles
Google News RSS: Get 100 Latest Articles on Any Topic (Free, No API Key)

Google News RSS: Get 100 Latest Articles on Any Topic (Free, No API Key)

via Dev.to WebdevАлексей Спинов

Google News has an RSS feed that returns the latest 100 articles for any search query. No API key, no rate limits. The URL Pattern https://news.google.com/rss/search?q=electric+vehicles&hl=en Returns XML with: title, source name, publication date, link, description. Node.js Example const { parseStringPromise } = require ( ' xml2js ' ); async function getGoogleNews ( query , lang = ' en ' ) { const url = `https://news.google.com/rss/search?q= ${ encodeURIComponent ( query )} &hl= ${ lang } ` ; const res = await fetch ( url ); const xml = await res . text (); const parsed = await parseStringPromise ( xml ); return ( parsed . rss . channel [ 0 ]. item || []). map ( item => ({ title : item . title [ 0 ], source : item . source ?.[ 0 ]?. _ || '' , date : item . pubDate [ 0 ], link : item . link [ 0 ], description : ( item . description ?.[ 0 ] || '' ). replace ( /< [^ > ] +>/g , '' ). substring ( 0 , 200 ) })); } const news = await getGoogleNews ( ' artificial intelligence ' ); console . lo

Continue reading on Dev.to Webdev

Opens in a new tab

Read Full Article
2 views

Related Articles