mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-11 07:40:26 +08:00
feat: add pocket trending (#3297)
This commit is contained in:
@@ -71,6 +71,12 @@ pageClass: routes
|
|||||||
|
|
||||||
<Route author="fengkx" example="/one" path="/one"/>
|
<Route author="fengkx" example="/one" path="/one"/>
|
||||||
|
|
||||||
|
## Pocket
|
||||||
|
|
||||||
|
### Trending
|
||||||
|
|
||||||
|
<Route author="hoilc" example="/pocket/trending" path="/pocket/trending"/>
|
||||||
|
|
||||||
## SANS Institute
|
## SANS Institute
|
||||||
|
|
||||||
### 最新会议材料
|
### 最新会议材料
|
||||||
|
|||||||
@@ -1861,4 +1861,7 @@ router.get('/hatena/anonymous_diary/archive', require('./routes/hatena/anonymous
|
|||||||
// kaggle
|
// kaggle
|
||||||
router.get('/kaggle/discussion/:forumId/:sort?', require('./routes/kaggle/discussion'));
|
router.get('/kaggle/discussion/:forumId/:sort?', require('./routes/kaggle/discussion'));
|
||||||
|
|
||||||
|
// Pocket
|
||||||
|
router.get('/pocket/trending', require('./routes/pocket/trending'));
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|||||||
26
lib/routes/pocket/trending.js
Normal file
26
lib/routes/pocket/trending.js
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
const got = require('@/utils/got');
|
||||||
|
const cheerio = require('cheerio');
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const url = 'https://getpocket.com/explore/trending';
|
||||||
|
|
||||||
|
const response = await got.get(url);
|
||||||
|
const $ = cheerio.load(response.data);
|
||||||
|
|
||||||
|
const list = $('.item').toArray();
|
||||||
|
|
||||||
|
ctx.state.data = {
|
||||||
|
title: 'Trending on Pocket',
|
||||||
|
description: 'Top Articles and Videos about Trending on Pocket',
|
||||||
|
link: url,
|
||||||
|
item: list.map((item) => {
|
||||||
|
item = $(item);
|
||||||
|
return {
|
||||||
|
title: item.find('.title').text(),
|
||||||
|
author: item.find('.domain > a').text(),
|
||||||
|
description: `<p>${item.find('.excerpt').text()}</p><img src="${item.find('.item_image').attr('data-thumburl')}" />`,
|
||||||
|
link: item.find('.item_link').attr('data-saveurl'),
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user