From 800cea5c2730b0ca206d32a621e9040a1cd06afe Mon Sep 17 00:00:00 2001 From: Austin Huang Date: Mon, 30 Oct 2017 09:17:07 -0400 Subject: [PATCH 1/5] Update find.js --- lib/find.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/lib/find.js b/lib/find.js index 317c369..2f5c85c 100644 --- a/lib/find.js +++ b/lib/find.js @@ -24,21 +24,29 @@ result.query = query; result.sectionHeader = $('div.section-header h3').text(); - result.result = $('ul.overview-list.badge-entry-collection > li').map(function() { + result.result = $('div.badge-entry-collection > article').map(function() { var item = { title: null, id: null, url: null, - image: null + image: null, + points: null, + commentCount: null }; - item.title = $(this).children('.info').children('h3').text().trim(); + item.title = $(this).children('header').children('h2.badge-item-title').children('a').text().trim(); item.id = $(this).attr('data-entry-id'); - item.url = "http://9gag.com" + $(this).attr('data-entry-url'); - item.image = $(this).children('.post-container').children('img').attr('src'); + + var link = $(this).children('div.post-container').children('a').attr('href'); + item.url = link.indexOf('9gag.com') === -1 ? ('http://9gag.com' + link) : link; + item.image = $(this).children('div.post-container').children('a').children('img').attr('src'); + item.points = $(this).children('p.post-meta').children('a.badge-evt.point').children('span.badge-item-love-count').text().trim(); + item.commentCount = $(this).children('p.post-meta').children('a.badge-evt.comment').text().trim(); + item.commentCount = item.commentCount.substring(0, item.commentCount.indexOf(' comments')); + return item; }).get(); return next(null, result); }); } -}()); \ No newline at end of file +}()); From 14cd38e31cdb8f2c57fac9b4ba987bcad1e9fc93 Mon Sep 17 00:00:00 2001 From: Austin Huang Date: Mon, 30 Oct 2017 09:27:40 -0400 Subject: [PATCH 2/5] Update find.js --- lib/find.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/find.js b/lib/find.js index 2f5c85c..6150cd2 100644 --- a/lib/find.js +++ b/lib/find.js @@ -33,7 +33,7 @@ points: null, commentCount: null }; - item.title = $(this).children('header').children('h2.badge-item-title').children('a').text().trim(); + item.title = $(this).children('header').children('a').children('h1.badge-item-title').text().trim(); item.id = $(this).attr('data-entry-id'); var link = $(this).children('div.post-container').children('a').attr('href'); From 571bfe3ce0b8166b4591a5f14a522c5f0b9d2b68 Mon Sep 17 00:00:00 2001 From: Austin Huang Date: Thu, 23 Nov 2017 21:29:40 -0500 Subject: [PATCH 3/5] Update section.js --- lib/section.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/section.js b/lib/section.js index 90158d9..49a1a78 100644 --- a/lib/section.js +++ b/lib/section.js @@ -42,9 +42,10 @@ }; item.title = $(this).children('header').children('h2.badge-item-title').children('a').text().trim(); item.id = $(this).attr('data-entry-id'); + item.url = $(this).attr('data-entry-url'); - var link = $(this).children('div.post-container').children('a').attr('href'); - item.url = link.indexOf('9gag.com') === -1 ? ('http://9gag.com' + link) : link; + /*var link = $(this).children('div.post-container').children('a').attr('href'); + item.url = link.indexOf('9gag.com') === -1 ? ('http://9gag.com' + link) : link;*/ item.image = $(this).children('div.post-container').children('a').children('img').attr('src'); item.points = $(this).children('p.post-meta').children('a.badge-evt.point').children('span.badge-item-love-count').text().trim(); item.commentCount = $(this).children('p.post-meta').children('a.badge-evt.comment').text().trim(); From 867ae00bdc2ce0e1720acef771fa22575cb74239 Mon Sep 17 00:00:00 2001 From: Austin Huang Date: Wed, 6 Dec 2017 17:49:13 -0500 Subject: [PATCH 4/5] Update section.js --- lib/section.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/section.js b/lib/section.js index 49a1a78..42c2c17 100644 --- a/lib/section.js +++ b/lib/section.js @@ -43,9 +43,6 @@ item.title = $(this).children('header').children('h2.badge-item-title').children('a').text().trim(); item.id = $(this).attr('data-entry-id'); item.url = $(this).attr('data-entry-url'); - - /*var link = $(this).children('div.post-container').children('a').attr('href'); - item.url = link.indexOf('9gag.com') === -1 ? ('http://9gag.com' + link) : link;*/ item.image = $(this).children('div.post-container').children('a').children('img').attr('src'); item.points = $(this).children('p.post-meta').children('a.badge-evt.point').children('span.badge-item-love-count').text().trim(); item.commentCount = $(this).children('p.post-meta').children('a.badge-evt.comment').text().trim(); From 158cda12ac029f38fa03b727dfb34abb551771cf Mon Sep 17 00:00:00 2001 From: Austin Huang Date: Tue, 9 Jan 2018 13:39:12 -0500 Subject: [PATCH 5/5] Update section.js --- lib/section.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/section.js b/lib/section.js index 42c2c17..af6d733 100644 --- a/lib/section.js +++ b/lib/section.js @@ -41,8 +41,8 @@ commentCount: null }; item.title = $(this).children('header').children('h2.badge-item-title').children('a').text().trim(); - item.id = $(this).attr('data-entry-id'); - item.url = $(this).attr('data-entry-url'); + item.id = $(this).children('div.post-container').children('a').attr('data-entry-id'); + item.url = $(this).children('div.post-container').children('a').attr('href'); item.image = $(this).children('div.post-container').children('a').children('img').attr('src'); item.points = $(this).children('p.post-meta').children('a.badge-evt.point').children('span.badge-item-love-count').text().trim(); item.commentCount = $(this).children('p.post-meta').children('a.badge-evt.comment').text().trim();