From 85320d216bf310ca8d85ccb73573ee9e68e12ff4 Mon Sep 17 00:00:00 2001 From: Sahat Yalkabov Date: Fri, 3 Jan 2014 05:12:00 -0500 Subject: [PATCH] Fixed hacker news api web scraping example --- controllers/api.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controllers/api.js b/controllers/api.js index ddfd5217b9..e0ff850484 100644 --- a/controllers/api.js +++ b/controllers/api.js @@ -123,8 +123,8 @@ exports.getScraping = function(req, res, next) { if (err) return next(err); var $ = cheerio.load(body); var links = []; - $('.title').find('a').slice(0,30).each(function(i, elem) { - links.push($(elem)); + $('.title a').each(function() { + links.push($(this)); }); res.render('api/scraping', { title: 'Web Scraping',