Created
August 27, 2016 03:02
-
-
Save cpoliver/e9afa8749e6d40fb6a36fbbd2e08a476 to your computer and use it in GitHub Desktop.
fetch to parse rss via (now deprecated) Google Feeds API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Live demo: http://jsbin.com/yineli/2/edit?js,console