* add(route): 首席经济学家论坛 * fix(route) : merge from FledgeXu * fix(route) : merge from FledgeXu * (fix) typo * feat(route): remove radar from radar-rules.js * Update lib/v2/chinacef/hot.js Co-authored-by: Tony <TonyRL@users.noreply.github.com> * Update lib/v2/chinacef/router.js Co-authored-by: Tony <TonyRL@users.noreply.github.com> * Update lib/v2/chinacef/maintainer.js Co-authored-by: Tony <TonyRL@users.noreply.github.com> * Update lib/v2/chinacef/experts.js Co-authored-by: Tony <TonyRL@users.noreply.github.com> * Update lib/v2/chinacef/experts.js Co-authored-by: Tony <TonyRL@users.noreply.github.com> * Update hot.js * Update experts.js * docs: fix Route's path and example of chinacef * Revert "docs: fix Route's path and example of chinacef" This reverts commit 0ec9e7d9d6d1eff201482e38a26b255478861a5c. * docs: fix Route's path and example of chinacef * feat(route): add chinafactcheck Co-authored-by: linkai <linkai@mochasoft.com.cn> Co-authored-by: Tony <TonyRL@users.noreply.github.com>
39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
const utils = require('./utils');
|
|
const cheerio = require('cheerio');
|
|
const got = require('@/utils/got');
|
|
|
|
module.exports = async (ctx) => {
|
|
const rssTitle = '有据|国际新闻事实核查';
|
|
|
|
const response = await got('https://chinafactcheck.com');
|
|
const $ = cheerio.load(response.data);
|
|
|
|
const articlesLinkListNode = $('.post-info-box .post-thumb a')
|
|
.map((_, item) => $(item).attr('href'))
|
|
.get();
|
|
const articlesLinkList = Array.from(new Set(articlesLinkListNode));
|
|
|
|
const articles = await Promise.all(
|
|
articlesLinkList.map(async (item) => {
|
|
const articlesLink = item;
|
|
|
|
const detail = await ctx.cache.tryGet(articlesLink, async () => await utils.getArticleDetail(articlesLink));
|
|
|
|
const element = {
|
|
title: detail.title,
|
|
author: detail.author,
|
|
pubDate: detail.time,
|
|
description: detail.description,
|
|
link: articlesLink,
|
|
};
|
|
return element;
|
|
})
|
|
);
|
|
|
|
ctx.state.data = {
|
|
title: rssTitle,
|
|
link: utils.siteLink,
|
|
item: articles,
|
|
};
|
|
};
|