mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-09 23:00:48 +08:00
feat: add route for aliyun developer topic (#4584)
This commit is contained in:
@@ -342,6 +342,10 @@ GitHub 官方也提供了一些 RSS:
|
||||
| 备案公告 | 3 |
|
||||
| 其他 | 4 |
|
||||
|
||||
### 开发者社区-主题
|
||||
|
||||
<Route author="umm233" example="/aliyun/developer/group/alitech" path="/aliyun/developer/group/:type" :paramsDesc="['对应技术领域分类']" />
|
||||
|
||||
## 安全客
|
||||
|
||||
::: tip 提示
|
||||
|
||||
@@ -1831,6 +1831,7 @@ router.get('/ctfhub/calendar/:limit?/:form?/:class?/:title?', require('./routes/
|
||||
// 阿里云
|
||||
router.get('/aliyun/database_month', require('./routes/aliyun/database_month'));
|
||||
router.get('/aliyun/notice/:type?', require('./routes/aliyun/notice'));
|
||||
router.get('/aliyun/developer/group/:type', require('./routes/aliyun/developer/group'));
|
||||
|
||||
// 礼物说
|
||||
router.get('/liwushuo/index', require('./routes/liwushuo/index.js'));
|
||||
|
||||
44
lib/routes/aliyun/developer/group.js
Normal file
44
lib/routes/aliyun/developer/group.js
Normal file
@@ -0,0 +1,44 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const type = ctx.params.type;
|
||||
const link = `https://developer.aliyun.com/group/${type}`;
|
||||
|
||||
// 发起 HTTP GET 请求
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: link,
|
||||
});
|
||||
|
||||
const data = response.data;
|
||||
|
||||
// 使用 cheerio 加载返回的 HTML
|
||||
const $ = cheerio.load(data);
|
||||
const title = $('div[class="header-information-title"]')
|
||||
.contents()
|
||||
.filter(function () {
|
||||
return this.nodeType === 3;
|
||||
})
|
||||
.text()
|
||||
.trim();
|
||||
const desc = $('div[class="header-information"]').find('span').last().text().trim();
|
||||
const list = $('ul[class^="content-tab-list"] > li');
|
||||
|
||||
ctx.state.data = {
|
||||
title: `阿里云开发者社区-${title}`,
|
||||
link,
|
||||
description: `${desc}`,
|
||||
item:
|
||||
list &&
|
||||
list
|
||||
.map((index, item) => {
|
||||
item = $(item);
|
||||
return {
|
||||
title: item.find('p').first().text().trim(),
|
||||
link: item.find('a').attr('href'),
|
||||
};
|
||||
})
|
||||
.get(),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user