Open JulianKingman opened 9 years ago
Me too
@repjackson I ended up using the cheerio library. I installed meteorhacks:npm, added the cheerio library, and used the following:
var $ = cheerio.load(Meteor.http.get(url).content, {});
var parsed = $('body *').not('style, script').map(function(idx, el) { return $(el).text(); }).get();
May be more than you need, but it worked for me. It returns an array of text in tags on the page. To get just the html, you can do $('body').html() (I think).
Impressive. Thank you.
OK, so I'm probably doing something wrong here... I have a method that returns a scraped page, and am debugging it, this is what I have:
However, in the server console it's logging an empty object ( '{}' ) Why am I not getting the correct content? It makes no difference if I pass the link or put it in directly, it also doesn't matter what URL I use.