mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-10 07:12:51 +08:00
feat: 添加码农周刊 (#3291)
This commit is contained in:
@@ -471,6 +471,12 @@ GitHub 官方也提供了一些 RSS:
|
||||
|
||||
</Route>
|
||||
|
||||
## 码农周刊
|
||||
|
||||
### issues
|
||||
|
||||
<Route author="tonghs" example="/manong-weekly" path="/manong-weekly" />
|
||||
|
||||
## 前端艺术家&&飞冰早报
|
||||
|
||||
### 列表
|
||||
|
||||
@@ -33,6 +33,12 @@ pageClass: routes
|
||||
|
||||
</Route>
|
||||
|
||||
## 码农周刊
|
||||
|
||||
### issues
|
||||
|
||||
<Route author="tonghs" example="/manong-weekly" path="/manong-weekly" />
|
||||
|
||||
## 扇贝
|
||||
|
||||
### 用户打卡
|
||||
|
||||
@@ -1871,4 +1871,7 @@ router.get('/mcbbs/post/:tid/:authorid?', require('./routes/mcbbs/post'));
|
||||
// Pocket
|
||||
router.get('/pocket/trending', require('./routes/pocket/trending'));
|
||||
|
||||
// 码农周刊
|
||||
router.get('/manong-weekly', require('./routes/manong-weekly/issues'));
|
||||
|
||||
module.exports = router;
|
||||
|
||||
33
lib/routes/manong-weekly/issues.js
Normal file
33
lib/routes/manong-weekly/issues.js
Normal file
@@ -0,0 +1,33 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const url = 'https://weekly.manong.io/issues/';
|
||||
const response = await got({
|
||||
rejectUnauthorized: false,
|
||||
method: 'get',
|
||||
url,
|
||||
});
|
||||
const $ = cheerio.load(response.data);
|
||||
const resultItem = $('.issue')
|
||||
.map((index, elem) => {
|
||||
elem = $(elem);
|
||||
const $link = elem.find('a');
|
||||
const title = $link.text();
|
||||
const link = $link.attr('href');
|
||||
const description = elem.find('p').text();
|
||||
|
||||
return {
|
||||
title,
|
||||
link,
|
||||
description,
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
ctx.state.data = {
|
||||
title: '码农周刊',
|
||||
link: url,
|
||||
item: resultItem,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user