Skip to content

Instantly share code, notes, and snippets.

@sayhicoelho
Created November 21, 2021 21:26
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 sayhicoelho/40e5c05a1450053003ae159ee1af4583 to your computer and use it in GitHub Desktop.
Save sayhicoelho/40e5c05a1450053003ae159ee1af4583 to your computer and use it in GitHub Desktop.
Fetch RSS using Node.js
const { parse } = require('rss-to-json')
async function fetchPosts() {
const rss = await parse('http://rss.uol.com.br/feed/economia.xml')
return rss.items
}
fetchPosts()
.then(posts => {
console.log(posts.map(p => p.title))
})
.catch(err => {
console.error(err)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment