mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-05 20:27:52 +08:00
* refactor: add no-implicit-coercion rule for ESLint * fix: errors from deepscan * fix: errors from deepscan * fix: errors from deepscan * fix: errors from deepscan * fix: errors from deepscan * Update docs/en/joinus/quick-start.md Co-authored-by: Sukka <isukkaw@gmail.com> * Update docs/joinus/quick-start.md Co-authored-by: Sukka <isukkaw@gmail.com> * Update lib/routes/av01/tag.js Co-authored-by: Sukka <isukkaw@gmail.com> * Update lib/routes/gov/taiwan/mnd.js Co-authored-by: Sukka <isukkaw@gmail.com> * Update lib/routes/ps/product.js Co-authored-by: Sukka <isukkaw@gmail.com> * refactor: minify html string Co-authored-by: Sukka <isukkaw@gmail.com>
34 lines
1.0 KiB
JavaScript
34 lines
1.0 KiB
JavaScript
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, '');
|
|
|
|
ctx.state.data = {
|
|
title: name,
|
|
link,
|
|
item: $('#docContent .content h3')
|
|
.map((_, item) => {
|
|
item = $(item);
|
|
const title = item.text().replace(/[\s|#]/g, '');
|
|
return {
|
|
title,
|
|
description: item.next().html(),
|
|
pubDate: new Date(new RegExp(/\d{4}-\d{2}-\d{2}/).exec(title) + ' GMT+8').toUTCString(),
|
|
link: link + item.find('a.header-anchor').attr('href'),
|
|
};
|
|
})
|
|
.get(),
|
|
description: name,
|
|
};
|
|
};
|