Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions lib/find.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically copied whatever used in section.js to here

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('a').children('h1.badge-item-title').text().trim();

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Title still doesn't work unfortunately

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);
});
}
}());
}());
6 changes: 2 additions & 4 deletions lib/section.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +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');

var link = $(this).children('div.post-container').children('a').attr('href');
item.url = link.indexOf('9gag.com') === -1 ? ('http://9gag.com' + link) : link;
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();
Expand Down