mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-08 05:59:00 +08:00
feat: 微信开放平台相关路由代码简化 (#3804)
This commit is contained in:
33
lib/routes/tencent/wechat/miniprogram/release.js
Normal file
33
lib/routes/tencent/wechat/miniprogram/release.js
Normal file
@@ -0,0 +1,33 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const link = 'https://developers.weixin.qq.com/miniprogram/dev/framework/release/';
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: link,
|
||||
});
|
||||
const data = response.data;
|
||||
const $ = cheerio.load(data);
|
||||
const name = $('#docContent .content h1')
|
||||
.text()
|
||||
.replace(/[\s|#]/g, '');
|
||||
const titles = $('#docContent .content h3').map((i, ele) =>
|
||||
$(ele)
|
||||
.text()
|
||||
.replace(/[\s|#]/g, '')
|
||||
);
|
||||
const list = $('#docContent > .content ol')
|
||||
.map((i, ele) => ({
|
||||
title: titles[i],
|
||||
description: $(ele).html(),
|
||||
}))
|
||||
.get();
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${name}最新动态`,
|
||||
link: link,
|
||||
item: list,
|
||||
description: '基础库更新日志RSS',
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user