Fixed hacker news api web scraping example
This commit is contained in:
@ -123,8 +123,8 @@ exports.getScraping = function(req, res, next) {
|
|||||||
if (err) return next(err);
|
if (err) return next(err);
|
||||||
var $ = cheerio.load(body);
|
var $ = cheerio.load(body);
|
||||||
var links = [];
|
var links = [];
|
||||||
$('.title').find('a').slice(0,30).each(function(i, elem) {
|
$('.title a').each(function() {
|
||||||
links.push($(elem));
|
links.push($(this));
|
||||||
});
|
});
|
||||||
res.render('api/scraping', {
|
res.render('api/scraping', {
|
||||||
title: 'Web Scraping',
|
title: 'Web Scraping',
|
||||||
|
Reference in New Issue
Block a user