mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-15 01:30:33 +08:00
Co-authored-by: SettingDust <settingdust@gmail.com> Co-authored-by: DIYgod <diy.d.god@gmail.com>
23 lines
795 B
JavaScript
23 lines
795 B
JavaScript
const got = require('@/utils/got');
|
|
const Cheerio = require('cheerio');
|
|
const loadArticle = require('./article');
|
|
|
|
module.exports = async (ctx, urlParam, title) => {
|
|
const link = new URL(urlParam, 'https://www.micmicidol.com/').toString();
|
|
const response = await got(link);
|
|
ctx.state.data = {
|
|
title: `micmicidol-${title}`,
|
|
link,
|
|
item:
|
|
response.body &&
|
|
(await Promise.all(
|
|
Cheerio.load(response.body)('.post.hentry')
|
|
.map((_, entry) => {
|
|
const { href } = Cheerio.load(entry)('.post-title.entry-title a')[0].attribs;
|
|
return ctx.cache.tryGet(href, () => loadArticle(href));
|
|
})
|
|
.toArray()
|
|
)),
|
|
};
|
|
};
|