Skip to content

Instantly share code, notes, and snippets.

@DanNi0130
Created July 19, 2018 01:24
Show Gist options
  • Save DanNi0130/769fa2f7877135737cc67ea0e8a9c1a3 to your computer and use it in GitHub Desktop.
Save DanNi0130/769fa2f7877135737cc67ea0e8a9c1a3 to your computer and use it in GitHub Desktop.
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
});
}
@JOE1994
Copy link

JOE1994 commented Mar 25, 2019

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
)

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