* ✨ feat(route): add blog: huangz * 🐞 fix(route): huangz url missing * 📃 docs(radar): update docs url * 📃 docs(radar): fix url * ✨ feat(route): add maintainer.js * 🐞 fix(radar): fix huangz blog radar source * Update lib/v2/huangz/index.js Co-authored-by: Tony <TonyRL@users.noreply.github.com> * Update lib/v2/huangz/radar.js Co-authored-by: Tony <TonyRL@users.noreply.github.com> * Update lib/v2/huangz/radar.js Co-authored-by: Tony <TonyRL@users.noreply.github.com> * Update index.js * style: auto format * docs: fix link break Co-authored-by: Tony <TonyRL@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
30 lines
738 B
JavaScript
30 lines
738 B
JavaScript
const got = require('@/utils/got');
|
|
const cheerio = require('cheerio');
|
|
|
|
const BLOG_URL = 'https://blog.huangz.me/';
|
|
|
|
module.exports = async (ctx) => {
|
|
const resp = await got({
|
|
method: 'get',
|
|
url: BLOG_URL,
|
|
});
|
|
const $ = cheerio.load(resp.body);
|
|
const list = $('.toctree-l2');
|
|
|
|
const items = await Promise.all(
|
|
list.map((index, item) => {
|
|
const link = `${BLOG_URL}${$(item).find('a').attr('href')}`;
|
|
|
|
return ctx.cache.tryGet(link, () => ({
|
|
title: $(item).find('a').text(),
|
|
link,
|
|
}));
|
|
})
|
|
);
|
|
ctx.state.data = {
|
|
title: 'huangz/blog',
|
|
link: 'https://blog.huangz.me',
|
|
item: items,
|
|
};
|
|
};
|