Created
July 19, 2018 01:24
-
-
Save DanNi0130/769fa2f7877135737cc67ea0e8a9c1a3 to your computer and use it in GitHub Desktop.
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 rp = require('request-promise'); | |
const $ = require('cheerio'); | |
const url = 'https://en.wikipedia.org/wiki/List_of_Presidents_of_the_United_States'; | |
rp(url) | |
.then(function(html){ | |
//success! | |
console.log($('big > a', html).length); | |
console.log($('big > a', html)); | |
}) | |
.catch(function(err){ | |
//handle error | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello :)
It seems like the closing parenthesis on line 14 is not needed in the code.
Thank you for the helpful post!
(
The Ultimate Guide to Web Scraping with Node.js,
https://medium.freecodecamp.org/the-ultimate-guide-to-web-scraping-with-node-js-daa2027dcd3
)