feat(route): Add Huggingface Daily Papers (#12720)

* Add Huggingface Daily Papers

* Add en docs

* Follow script standard

* Place under huggingface namespace
Move docs to programming

* Fix route element in docs en

* Update div selector
This commit is contained in:
Elsa Granger
2023-06-30 02:41:49 +08:00
committed by GitHub
parent fa7cabe797
commit bb071cb597
5 changed files with 41 additions and 0 deletions
+6
View File
@@ -299,6 +299,12 @@ Subscribe to the updates (threads and submission) from a paritcular Hacker News
<RouteEn author="hellodword" example="/hex-rays/news" path="/hex-rays/news" />
## Huggingface
### Daily Papers
<RouteEn author="zeyugao" example="/huggingface/daily-papers" path="/huggingface/daily-papers" />
## Issue Hunt
### Project Funded
+6
View File
@@ -489,6 +489,12 @@ GitHub 官方也提供了一些 RSS:
<Route author="hellodword" example="/hex-rays/news" path="/hex-rays/news"/>
## Huggingface
### Daily Papers
<Route author="zeyugao" example="/huggingface/daily-papers" path="/huggingface/daily-papers" />
## Issue Hunt
### 项目悬赏
+23
View File
@@ -0,0 +1,23 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const { parseDate } = require('@/utils/parse-date');
module.exports = async (ctx) => {
const { body: response } = await got('https://huggingface.co/papers');
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.replace(/\n/g, ' '),
pubDate: parseDate(item.publishedAt),
author: item.paper.authors.map((author) => author.name).join(', '),
}));
ctx.state.data = {
title: 'Huggingface Daily Papers',
link: 'https://huggingface.co/papers',
item: items,
};
};
+3
View File
@@ -0,0 +1,3 @@
module.exports = {
'/daily-papers': ['zeyugao'],
};
+3
View File
@@ -0,0 +1,3 @@
module.exports = (router) => {
router.get('/daily-papers', require('./daily-papers'));
};