mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-10-29 18:06:31 +08:00
fix(route): qq fact (#11819)
This commit is contained in:
+1
-1
@@ -793,7 +793,7 @@ type 为 all 时,category 参数不支持 cost 和 free
|
||||
|
||||
### 最新辟谣
|
||||
|
||||
<Route author="hoilc" example="/factcheck" path="/factcheck"/>
|
||||
<Route author="hoilc" example="/qq/fact" path="/qq/fact" radar="1"/>
|
||||
|
||||
## 天津产权交易中心
|
||||
|
||||
|
||||
+1
-1
@@ -2122,7 +2122,7 @@ router.get('/wineyun/:category', lazyloadRouteHandler('./routes/wineyun'));
|
||||
router.get('/kzfeed/topic/:id', lazyloadRouteHandler('./routes/kzfeed/topic'));
|
||||
|
||||
// 腾讯新闻较真查证平台
|
||||
router.get('/factcheck', lazyloadRouteHandler('./routes/tencent/factcheck'));
|
||||
// router.get('/factcheck', lazyloadRouteHandler('./routes/tencent/factcheck'));
|
||||
|
||||
// X-MOL化学资讯平台
|
||||
router.get('/x-mol/news/:tag?', lazyloadRouteHandler('./routes/x-mol/news.js'));
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
const got = require('@/utils/got');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const cheerio = require('cheerio');
|
||||
const CryptoJS = require('crypto-js');
|
||||
|
||||
const getRequestToken = () => {
|
||||
const t = 'jzhotdata',
|
||||
e = 'sgn51n6r6q97o6g3',
|
||||
n = CryptoJS.DES.encrypt(Date.now().toString() + '-' + e, t).toString();
|
||||
return encodeURIComponent(n);
|
||||
};
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://vp.fact.qq.com/loadmore?artnum=0&page=0&token=${getRequestToken()}`,
|
||||
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: parseDate(item.date, 'YYYY-MM-DD'),
|
||||
author: item.author,
|
||||
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}"><br>查证要点:${$('.check_content_points').html()}<br>${$('.check_content_writer').html()}`,
|
||||
};
|
||||
});
|
||||
return Promise.resolve(Object.assign({}, simple, details));
|
||||
})
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: '较真查证平台-腾讯新闻',
|
||||
link: 'https://vp.fact.qq.com/home',
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,61 @@
|
||||
const got = require('@/utils/got');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const cheerio = require('cheerio');
|
||||
const CryptoJS = require('crypto-js');
|
||||
const { art } = require('@/utils/render');
|
||||
const path = require('path');
|
||||
|
||||
const getRequestToken = () => {
|
||||
const e = 'sgn51n6r6q97o6g3';
|
||||
const t = 'jzhotdata';
|
||||
return CryptoJS.DES.encrypt(`${Date.now().toString()}-${e}`, t).toString();
|
||||
};
|
||||
|
||||
const baseUrl = 'https://vp.fact.qq.com';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { data: response } = await got(`${baseUrl}/api/article/list`, {
|
||||
headers: {
|
||||
Referer: `${baseUrl}/home`,
|
||||
},
|
||||
searchParams: {
|
||||
page: 1,
|
||||
locale: 'zh-CN',
|
||||
token: getRequestToken(),
|
||||
},
|
||||
});
|
||||
|
||||
const list = response.data.list.map((item) => ({
|
||||
title: `【${item.explain}】${item.title}`,
|
||||
description: `<img src="${item.cover}"><br>${item.abstract}`,
|
||||
pubDate: parseDate(item.date, 'YYYY-MM-DD'),
|
||||
author: `${item.Author.name} - ${item.Author.desc}`,
|
||||
category: item.tag,
|
||||
link: `${baseUrl}/article?id=${item.id}`,
|
||||
}));
|
||||
|
||||
const items = await Promise.all(
|
||||
list.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const response = await got(item.link);
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const nextData = JSON.parse($('#__NEXT_DATA__').text());
|
||||
const { initialState } = nextData.props.pageProps;
|
||||
|
||||
item.description = art(path.join(__dirname, '../templates/article.art'), {
|
||||
data: initialState,
|
||||
});
|
||||
item.pubDate = parseDate(initialState.createdAt);
|
||||
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: '较真查证平台 - 腾讯新闻',
|
||||
link: `${baseUrl}/home`,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
@@ -1,6 +1,7 @@
|
||||
module.exports = {
|
||||
'/ac/comic/:id': ['nczitzk'],
|
||||
'/ac/rank/:type?/:time?': ['nczitzk'],
|
||||
'/fact': ['hoilc'],
|
||||
'/kg/:userId': ['zhangxiang012'],
|
||||
'/kg/reply/:playId': ['zhangxiang012'],
|
||||
'/live/:id': ['nczitzk'],
|
||||
|
||||
@@ -37,5 +37,13 @@ module.exports = {
|
||||
target: (_params, url) => `/qq/kg/${new URL(url).searchParams.get('s')}`,
|
||||
},
|
||||
],
|
||||
'vp.fact': [
|
||||
{
|
||||
title: '最新辟谣',
|
||||
docs: 'https://docs.rsshub.app/other.html#teng-xun-xin-wen-jiao-zhen-cha-zheng-ping-tai',
|
||||
source: ['/home', '/'],
|
||||
target: '/qq/fact',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
module.exports = function (router) {
|
||||
router.get('/ac/comic/:id?', require('./ac/comic'));
|
||||
router.get('/ac/rank/:type?/:time?', require('./ac/rank'));
|
||||
router.get('/fact', require('./fact'));
|
||||
router.get('/kg/:userId', require('./kg/user'));
|
||||
router.get('/kg/reply/:playId', require('./kg/reply'));
|
||||
router.get('/live/:id', require('./live'));
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
{{ if data.cover }}
|
||||
<img src="<%= data.cover.startsWith('//') ? `https:${data.cover}` : !data.cover.startsWith('http') ? `https://${data.cover}` : data.cover %>">
|
||||
{{ /if }}
|
||||
|
||||
{{ if data.rumor }}
|
||||
<div class="saying">流传说法:{{ data.rumor }}</div>
|
||||
{{ /if }}
|
||||
|
||||
{{ if data.abstract }}查证要点:
|
||||
<ol>
|
||||
{{ each data.abstract item }}
|
||||
<li>{{ item.content }}</li>
|
||||
{{ /each }}
|
||||
</ol>
|
||||
{{ /if }}
|
||||
|
||||
{{ if data.content }}
|
||||
<div class="dangerouslySet">{{@ data.content }}</div>
|
||||
{{ /if }}
|
||||
Reference in New Issue
Block a user