mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
feat(route): Support sortby upvotes in Huggingface Daily Papers (#14484)
* Support sortby upvotes in Huggingface Daily Papers
* Revert "Support sortby upvotes in Huggingface Daily Papers"
This reverts commit 6e43f8e8a2.
* Only sort by upvotes
---------
This commit is contained in:
@@ -7,13 +7,16 @@ module.exports = async (ctx) => {
|
||||
const $ = cheerio.load(response);
|
||||
const papers = $('main > div[data-target="DailyPapers"]').data('props');
|
||||
|
||||
const items = papers.dailyPapers.map((item) => ({
|
||||
title: item.title,
|
||||
link: `https://arxiv.org/abs/${item.paper.id}`,
|
||||
description: item.paper.summary.replaceAll('\n', ' '),
|
||||
pubDate: parseDate(item.publishedAt),
|
||||
author: item.paper.authors.map((author) => author.name).join(', '),
|
||||
}));
|
||||
const items = papers.dailyPapers
|
||||
.map((item) => ({
|
||||
title: item.title,
|
||||
link: `https://arxiv.org/abs/${item.paper.id}`,
|
||||
description: item.paper.summary.replaceAll('\n', ' '),
|
||||
pubDate: parseDate(item.publishedAt),
|
||||
author: item.paper.authors.map((author) => author.name).join(', '),
|
||||
upvotes: item.paper.upvotes,
|
||||
}))
|
||||
.sort((a, b) => b.upvotes - a.upvotes);
|
||||
|
||||
ctx.state.data = {
|
||||
title: 'Huggingface Daily Papers',
|
||||
|
||||
Reference in New Issue
Block a user