mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
feat: pediy filter top topics (#5335)
This commit is contained in:
@@ -55,12 +55,17 @@ module.exports = async (ctx) => {
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const list = $('.thread');
|
||||
|
||||
const resultItem = await Promise.all(
|
||||
list
|
||||
? list
|
||||
// fix .thread .top_3
|
||||
.filter((_, elem) => {
|
||||
const pubDate = pediyUtils.dateParser($('.date', elem).eq(0).text(), 8);
|
||||
return elem.attribs.class.indexOf('top') === -1 || new Date() - new Date(pubDate) < 1000 * 60 * 60 * 24 * 3;
|
||||
})
|
||||
.map(async (_, elem) => {
|
||||
const subject = $('.subject a', elem).eq(1);
|
||||
|
||||
const pubDate = pediyUtils.dateParser($('.date', elem).eq(0).text(), 8);
|
||||
|
||||
const link = `${baseUrl}${subject.attr('href')}`;
|
||||
|
||||
Reference in New Issue
Block a user