Skip to content

Instantly share code, notes, and snippets.

@cpoliver
Created August 27, 2016 03:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cpoliver/e9afa8749e6d40fb6a36fbbd2e08a476 to your computer and use it in GitHub Desktop.
Save cpoliver/e9afa8749e6d40fb6a36fbbd2e08a476 to your computer and use it in GitHub Desktop.
fetch to parse rss via (now deprecated) Google Feeds API
const entryCount = 2;
const corsProxyUrl = 'https://crossorigin.me';
const feedUrl = 'http://feeds.bbci.co.uk/news/world/rss.xml';
const googleUrl = `http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&q=${feedUrl}&num=${entryCount}`;
const url = `${corsProxyUrl}/${googleUrl}`;
const logFeeds = response => response.responseData.feed.entries.map(console.log);
fetch(url)
.then(response => response.json())
.then(logFeeds);
@cpoliver
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment