Created
November 21, 2021 21:26
-
-
Save sayhicoelho/40e5c05a1450053003ae159ee1af4583 to your computer and use it in GitHub Desktop.
Fetch RSS using Node.js
This file contains 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 { 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