mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-02 01:58:11 +08:00
fix(route): 腾讯企鹅号正文乱码 (#12130)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
module.exports = {
|
||||
'/cloud/column/:id?/:tag?': ['nczitzk'],
|
||||
'/news/author/:mid': ['LogicJake', 'miles170'],
|
||||
'/news/coronavirus/data/:province?/:city?': ['CaoMeiYouRen'],
|
||||
'/news/coronavirus/total': ['CaoMeiYouRen'],
|
||||
'/pvp/newsindex/:type': ['Jeason0228', 'HenryQW'],
|
||||
|
||||
44
lib/v2/tencent/news/author.js
Normal file
44
lib/v2/tencent/news/author.js
Normal file
@@ -0,0 +1,44 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const timezone = require('@/utils/timezone');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const mid = ctx.params.mid;
|
||||
const response = await got(`https://pacaio.match.qq.com/om/mediaArticles?mid=${mid}&num=10&page=0`);
|
||||
const reponse = response.data;
|
||||
const title = reponse.mediainfo.name;
|
||||
const description = reponse.mediainfo.intro;
|
||||
const list = reponse.data;
|
||||
|
||||
const items = await Promise.all(
|
||||
list.map((item) => {
|
||||
const title = item.title;
|
||||
const pubDate = timezone(parseDate(item.time), +8);
|
||||
const itemUrl = item.vurl;
|
||||
const author = item.source;
|
||||
const abstract = item.abstract;
|
||||
|
||||
return ctx.cache.tryGet(itemUrl, async () => {
|
||||
const response = await got(itemUrl);
|
||||
const $ = cheerio.load(response.data);
|
||||
const article = $('div.content-article');
|
||||
|
||||
return {
|
||||
title,
|
||||
description: article.html() || abstract,
|
||||
link: itemUrl,
|
||||
author,
|
||||
pubDate,
|
||||
};
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title,
|
||||
description,
|
||||
link: `https://new.qq.com/omn/author/${mid}`,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
@@ -27,7 +27,13 @@ module.exports = {
|
||||
target: (params, url) => `/wechat/mp/msgalbum/${new URL(url).searchParams.get('__biz')}/${new URL(url).searchParams.get('album_id')}`,
|
||||
},
|
||||
],
|
||||
news: [
|
||||
new: [
|
||||
{
|
||||
title: '腾讯企鹅号 - 更新',
|
||||
docs: 'https://docs.rsshub.app/new-media.html#teng-xun-qi-e-hao-geng-xin',
|
||||
source: ['/omn/author/:mid'],
|
||||
target: '/tencent/news/author/:mid',
|
||||
},
|
||||
{
|
||||
title: '腾讯新闻 - 新型冠状病毒肺炎疫情实时追踪',
|
||||
docs: 'https://docs.rsshub.app/other.html#xin-guan-fei-yan-yi-qing-xin-wen-dong-tai',
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
module.exports = (router) => {
|
||||
router.get('/cloud/column/:id?/:tag?', require('./cloud/column'));
|
||||
router.get('/news/author/:mid', require('./news/author'));
|
||||
router.get('/news/coronavirus/data/:province?/:city?', require('./news/coronavirus/data'));
|
||||
router.get('/news/coronavirus/total', require('./news/coronavirus/total'));
|
||||
router.get('/pvp/newsindex/:type', require('./pvp/newsindex'));
|
||||
|
||||
Reference in New Issue
Block a user