mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-08 05:59:00 +08:00
feat: add /coronavirus/qq/fact
This commit is contained in:
@@ -406,6 +406,10 @@ type 为 all 时,category 参数不支持 cost 和 free
|
||||
|
||||
<Route author="DIYgod HenryQW" example="/coronavirus/dxy/data/湖北/武汉" path="/coronavirus/dxy/data/:province?/:city?" :paramsDesc="['省/直辖市名,缺省或错误则返回全国数据','城市名,缺省或错误则返回全省数据。直辖市请使用区/县名。']"/>
|
||||
|
||||
### 腾讯新闻 - 新型冠状病毒肺炎实时辟谣
|
||||
|
||||
<Route author="DIYgod" example="/coronavirus/qq/fact" path="/coronavirus/qq/fact"/>
|
||||
|
||||
### South China Morning Post - China coronavirus outbreak
|
||||
|
||||
<Route author="DIYgod" example="/coronavirus/scmp" path="/coronavirus/scmp"/>
|
||||
|
||||
@@ -2162,6 +2162,7 @@ router.get('/coronavirus/dxy', require('./routes/coronavirus/dxy'));
|
||||
router.get('/coronavirus/scmp', require('./routes/coronavirus/scmp'));
|
||||
router.get('/coronavirus/nhc', require('./routes/coronavirus/nhc'));
|
||||
router.get('/coronavirus/mogov-2019ncov/:lang', require('./routes/coronavirus/mogov-2019ncov'));
|
||||
router.get('/coronavirus/qq/fact', require('./routes/coronavirus/qq-fact'));
|
||||
|
||||
// 南京林业大学教务处
|
||||
router.get('/njfu/jwc/:category?', require('./routes/universities/njfu/jwc'));
|
||||
|
||||
42
lib/routes/coronavirus/qq-fact.js
Normal file
42
lib/routes/coronavirus/qq-fact.js
Normal file
@@ -0,0 +1,42 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: 'https://vp.fact.qq.com/loadmore?artnum=0&page=0',
|
||||
headers: {
|
||||
Referer: 'https://vp.fact.qq.com/home',
|
||||
},
|
||||
});
|
||||
|
||||
const data = response.data.content;
|
||||
|
||||
const items = await Promise.all(
|
||||
(data || []).map(async (item) => {
|
||||
const link = `https://vp.fact.qq.com/article?id=${item.id}`;
|
||||
const simple = {
|
||||
title: `【${item.explain}】${item.title}`,
|
||||
description: `<img src="${item.cover}">${item.abstract}`,
|
||||
pubDate: new Date(item.date).toUTCString(),
|
||||
author: item.author,
|
||||
link: link,
|
||||
};
|
||||
|
||||
const details = await ctx.cache.tryGet(link, async () => {
|
||||
const response = await got.get(link);
|
||||
const $ = cheerio.load(response.data);
|
||||
return {
|
||||
description: `<img src="${item.cover}">${$('.check_content_points').html()}`,
|
||||
};
|
||||
});
|
||||
return Promise.resolve(Object.assign({}, simple, details));
|
||||
})
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: '新型冠状病毒肺炎实时辟谣-腾讯新闻',
|
||||
link: 'https://vp.fact.qq.com/home',
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user