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:
@@ -3758,7 +3758,7 @@ column 为 third 时可选的 category:
|
|||||||
|
|
||||||
### 更新
|
### 更新
|
||||||
|
|
||||||
<Route author="LogicJake" example="/tencent/news/author/5933889" path="/tencent/news/author/:mid" :paramsDesc="['企鹅号 ID']"/>
|
<Route author="LogicJake" example="/tencent/news/author/5933889" path="/tencent/news/author/:mid" :paramsDesc="['企鹅号 ID']" radar="1"/>
|
||||||
|
|
||||||
## 腾讯研究院
|
## 腾讯研究院
|
||||||
|
|
||||||
|
|||||||
@@ -2044,8 +2044,8 @@ router.get('/nciae/xsxx', lazyloadRouteHandler('./routes/universities/nciae/xsxx
|
|||||||
// cfan
|
// cfan
|
||||||
router.get('/cfan/news', lazyloadRouteHandler('./routes/cfan/news'));
|
router.get('/cfan/news', lazyloadRouteHandler('./routes/cfan/news'));
|
||||||
|
|
||||||
// 腾讯企鹅号
|
// 腾讯企鹅号 migrated to v2
|
||||||
router.get('/tencent/news/author/:mid', lazyloadRouteHandler('./routes/tencent/news/author'));
|
// router.get('/tencent/news/author/:mid', lazyloadRouteHandler('./routes/tencent/news/author'));
|
||||||
|
|
||||||
// 奈菲影视
|
// 奈菲影视
|
||||||
router.get('/nfmovies/:id?', lazyloadRouteHandler('./routes/nfmovies/index'));
|
router.get('/nfmovies/:id?', lazyloadRouteHandler('./routes/nfmovies/index'));
|
||||||
|
|||||||
@@ -1,59 +0,0 @@
|
|||||||
const got = require('@/utils/got');
|
|
||||||
const cheerio = require('cheerio');
|
|
||||||
const date = require('@/utils/date');
|
|
||||||
const iconv = require('iconv-lite');
|
|
||||||
|
|
||||||
module.exports = async (ctx) => {
|
|
||||||
const mid = ctx.params.mid;
|
|
||||||
const link = `https://new.qq.com/omn/author/${mid}`;
|
|
||||||
const api_url = `https://pacaio.match.qq.com/om/mediaArticles?mid=${mid}&num=15&page=0`;
|
|
||||||
const response = await got({
|
|
||||||
method: 'get',
|
|
||||||
url: api_url,
|
|
||||||
headers: { Referer: link },
|
|
||||||
});
|
|
||||||
const reponse = response.data;
|
|
||||||
const title = reponse.mediainfo.name;
|
|
||||||
const description = reponse.mediainfo.intro;
|
|
||||||
const list = reponse.data.splice(0, 10);
|
|
||||||
|
|
||||||
const items = await Promise.all(
|
|
||||||
list.map(async (item) => {
|
|
||||||
const title = item.title;
|
|
||||||
const unixTimestamp = new Date(item.timestamp * 1000);
|
|
||||||
const pubDate = date(unixTimestamp.toLocaleString(), 8);
|
|
||||||
const itemUrl = item.vurl;
|
|
||||||
const author = item.source;
|
|
||||||
const abstract = item.abstract;
|
|
||||||
|
|
||||||
const response = await ctx.cache.tryGet(
|
|
||||||
itemUrl,
|
|
||||||
async () =>
|
|
||||||
(
|
|
||||||
await got.get(itemUrl, {
|
|
||||||
responseType: 'buffer',
|
|
||||||
})
|
|
||||||
).data
|
|
||||||
);
|
|
||||||
const html = iconv.decode(response, 'gbk');
|
|
||||||
const $ = cheerio.load(html, { decodeEntities: false });
|
|
||||||
const article = $('div.content-article');
|
|
||||||
|
|
||||||
const single = {
|
|
||||||
title,
|
|
||||||
description: article.html() || abstract,
|
|
||||||
link: itemUrl,
|
|
||||||
author,
|
|
||||||
pubDate,
|
|
||||||
};
|
|
||||||
return Promise.resolve(single);
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
ctx.state.data = {
|
|
||||||
title,
|
|
||||||
description,
|
|
||||||
link,
|
|
||||||
item: items,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
'/cloud/column/:id?/:tag?': ['nczitzk'],
|
'/cloud/column/:id?/:tag?': ['nczitzk'],
|
||||||
|
'/news/author/:mid': ['LogicJake', 'miles170'],
|
||||||
'/news/coronavirus/data/:province?/:city?': ['CaoMeiYouRen'],
|
'/news/coronavirus/data/:province?/:city?': ['CaoMeiYouRen'],
|
||||||
'/news/coronavirus/total': ['CaoMeiYouRen'],
|
'/news/coronavirus/total': ['CaoMeiYouRen'],
|
||||||
'/pvp/newsindex/:type': ['Jeason0228', 'HenryQW'],
|
'/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')}`,
|
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: '腾讯新闻 - 新型冠状病毒肺炎疫情实时追踪',
|
title: '腾讯新闻 - 新型冠状病毒肺炎疫情实时追踪',
|
||||||
docs: 'https://docs.rsshub.app/other.html#xin-guan-fei-yan-yi-qing-xin-wen-dong-tai',
|
docs: 'https://docs.rsshub.app/other.html#xin-guan-fei-yan-yi-qing-xin-wen-dong-tai',
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
module.exports = (router) => {
|
module.exports = (router) => {
|
||||||
router.get('/cloud/column/:id?/:tag?', require('./cloud/column'));
|
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/data/:province?/:city?', require('./news/coronavirus/data'));
|
||||||
router.get('/news/coronavirus/total', require('./news/coronavirus/total'));
|
router.get('/news/coronavirus/total', require('./news/coronavirus/total'));
|
||||||
router.get('/pvp/newsindex/:type', require('./pvp/newsindex'));
|
router.get('/pvp/newsindex/:type', require('./pvp/newsindex'));
|
||||||
|
|||||||
Reference in New Issue
Block a user