mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-09 23:00:48 +08:00
feat: WIRED杂志根据标签订阅 (#2262)
* 增加连线wired根据标签订阅功能 * 在README中添加路由介绍 Co-authored-by: Suqian Zhang <zhang@oculavis.de>
This commit is contained in:
@@ -337,3 +337,13 @@ category 对应的关键词有
|
||||
| 资讯 | 风景 | 体验 | 交通 |
|
||||
|
||||
</Route>
|
||||
|
||||
## 连线 Wired
|
||||
|
||||
非订阅用户每月有阅读全文次数限制。
|
||||
|
||||
### 标签
|
||||
|
||||
<Route author="Naiqus" example="/wired/tag/bitcoin" path="/wired/tag/:tag" :paramsDesc="['标签']">
|
||||
|
||||
</Route>
|
||||
|
||||
@@ -1319,6 +1319,9 @@ router.get('/curseforge/:gameid/:catagoryid/:projectid/files', require('./routes
|
||||
// 西南财经大学
|
||||
router.get('/swufe/seie/:type?', require('./routes/universities/swufe/seie'));
|
||||
|
||||
// Wired
|
||||
router.get('/wired/tag/:tag', require('./routes/wired/tag'));
|
||||
|
||||
// 语雀文档
|
||||
router.get('/yuque/doc/:repo_id', require('./routes/yuque/doc'));
|
||||
|
||||
|
||||
39
lib/routes/wired/tag.js
Normal file
39
lib/routes/wired/tag.js
Normal file
@@ -0,0 +1,39 @@
|
||||
const axios = require('@/utils/axios');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const url = `https://www.wired.com/tag/${ctx.params.tag}/page`;
|
||||
|
||||
const response = await axios({
|
||||
method: 'get',
|
||||
url,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const list = $('.archive-list-component__items li');
|
||||
|
||||
const posts = list
|
||||
.map((index_, content_) => ({
|
||||
title: $(content_)
|
||||
.find('.archive-item-component__title')
|
||||
.text(),
|
||||
description: `<img referrerpolicy="no-referrer"
|
||||
src="${$(content_)
|
||||
.find('.image-group-component img')
|
||||
.attr('src')}">
|
||||
<br>
|
||||
${$(content_)
|
||||
.find('.archive-item-component__desc')
|
||||
.text()}`,
|
||||
link: `https://www.wired.com${$(content_)
|
||||
.find('.archive-item-component__link')
|
||||
.attr('href')}`,
|
||||
}))
|
||||
.get();
|
||||
|
||||
ctx.state.data = {
|
||||
title: `Wired - ${ctx.params.tag}`,
|
||||
link: url,
|
||||
item: posts,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user