mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-08-31 01:01:11 +08:00
feat(route): add 腾讯云云+社区专栏 (#9952)
This commit is contained in:
@@ -1045,6 +1045,12 @@ GitHub 官方也提供了一些 RSS:
|
||||
|
||||
</Route>
|
||||
|
||||
## 腾讯云
|
||||
|
||||
### 云 + 社区专栏
|
||||
|
||||
<Route author="nczitzk" example="/tencent/cloud/column/86410" path="/tencent/cloud/column/:id?/:tag?" :paramsDesc="['专栏 id,可在对应专栏页中找到,默认为 86410(腾讯云数据库专家服务)', '标签 id,可在对应专栏页中找到,默认为空']"/>
|
||||
|
||||
## 微信开放平台
|
||||
|
||||
### 微信开放社区 - 小程序公告
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id ?? '86410';
|
||||
const tag = ctx.params.tag ?? '';
|
||||
|
||||
const rootUrl = 'https://cloud.tencent.com';
|
||||
const currentUrl = `${rootUrl}/developer/column/${id}${tag ? `/tag-${tag}` : ''}`;
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: currentUrl,
|
||||
});
|
||||
|
||||
const data = JSON.parse(response.data.match(/window\.\$render\((.*?)\);/)[1]);
|
||||
|
||||
let items = data.articleData.list.map((item) => ({
|
||||
title: item.title,
|
||||
author: item.author.name,
|
||||
link: `${rootUrl}/developer/article/${item.id}`,
|
||||
pubDate: parseDate(item.updateTime * 1000),
|
||||
category: item.tags.map((tag) => tag.name),
|
||||
}));
|
||||
|
||||
items = await Promise.all(
|
||||
items.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const detailResponse = await got({
|
||||
method: 'get',
|
||||
url: item.link,
|
||||
});
|
||||
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
|
||||
content('.developer-code-block').remove();
|
||||
|
||||
item.description = content('.rno-markdown').html();
|
||||
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${data.columnDetail.name} - ${data.documentBaseTitle}`,
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
@@ -1,3 +1,4 @@
|
||||
module.exports = {
|
||||
'/qq/sdk/changelog/:platform': ['nuomi1'],
|
||||
'/cloud/column/:id?/:tag?': ['nczitzk'],
|
||||
};
|
||||
|
||||
@@ -53,4 +53,15 @@ module.exports = {
|
||||
},
|
||||
],
|
||||
},
|
||||
'tencent.com': {
|
||||
_name: '腾讯云',
|
||||
'.': [
|
||||
{
|
||||
title: '云+社区专栏',
|
||||
docs: 'https://docs.rsshub.app/programming.html#teng-xun-yun-yun-she-qu-zhuan-lan',
|
||||
source: ['/developer/column/:id', '/developer/column/:id/:tag', '/'],
|
||||
target: (params, url) => `/tencent/cloud/column/${url.match(/column\/(\d+)/)[1]}${/\/tag-\d+/.test(url) ? `/${url.match(/\/tag-(\d+)/)[1]}` : ''}`,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
module.exports = (router) => {
|
||||
router.get('/qq/sdk/changelog/:platform', require('./qq/sdk/changelog'));
|
||||
router.get('/cloud/column/:id?/:tag?', require('./cloud/column'));
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user