mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-19 09:52:21 +08:00
feat: add the batch from deeplearning.ai (#4795)
This commit is contained in:
@@ -24,6 +24,12 @@ pageClass: routes
|
||||
|
||||
<Route author="fengkx" example="/cve/search/PostgreSQL" path="/cve/search/:keyword" :paramsDesc="['关键词']" />
|
||||
|
||||
## deeplearning.ai
|
||||
|
||||
### TheBatch 周报
|
||||
|
||||
<Route author="nczitzk" example="/deeplearning/thebatch" path="/deeplearning/thebatch"/>
|
||||
|
||||
## Dockone
|
||||
|
||||
### 周报
|
||||
|
||||
@@ -2675,6 +2675,9 @@ router.get('/qingting/channel/:id', require('./routes/qingting/channel'));
|
||||
// 金色财经
|
||||
router.get('/jinse/lives', require('./routes/jinse/lives'));
|
||||
|
||||
// deeplearning.ai
|
||||
router.get('/deeplearningai/thebatch', require('./routes/deeplearningai/thebatch'));
|
||||
|
||||
// Fate Grand Order
|
||||
router.get('/fgo/news', require('./routes/fgo/news'));
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://www.deeplearning.ai/WPCore/wp-admin/admin-ajax.php?action=hubspot_reader_blog_the_batch&offset=0&limit=5`,
|
||||
});
|
||||
const list = response.data.data.map((item) => ({
|
||||
title: `${item.title} - ${item.name}`,
|
||||
link: item.web_view_url,
|
||||
pubDate: new Date(item.date).toUTCString(),
|
||||
}));
|
||||
|
||||
ctx.state.data = {
|
||||
title: `The Batch - a new weekly newsletter from deeplearning.ai`,
|
||||
link: `https://www.deeplearning.ai/thebatch/`,
|
||||
item: await Promise.all(
|
||||
list.map(
|
||||
async (item) =>
|
||||
await ctx.cache.tryGet(item.link, async () => {
|
||||
const contentResponse = await got({ method: 'get', url: item.link });
|
||||
const content = cheerio.load(contentResponse.data);
|
||||
item.description = content('td[style="width: 576px;"]').parent().html();
|
||||
return item;
|
||||
})
|
||||
)
|
||||
),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user