diff --git a/docs/social-media.md b/docs/social-media.md index 7a75a5d959..b5cfb855e9 100644 --- a/docs/social-media.md +++ b/docs/social-media.md @@ -617,6 +617,12 @@ pageClass: routes +## 腾讯 + +### 企鹅号 + + + ## 贴吧 ### 帖子列表 diff --git a/lib/router.js b/lib/router.js index b3d477bc5f..f7006817b8 100644 --- a/lib/router.js +++ b/lib/router.js @@ -1682,4 +1682,7 @@ router.get('/sohu/mp/:id', require('./routes/sohu/mp')); // 厚墨书源索引 router.get('/houmo/:code?', require('./routes/houmo/booksource')); +// 腾讯企鹅号 +router.get('/tencent/news/author/:mid', require('./routes/tencent/news/author')); + module.exports = router; diff --git a/lib/routes/tencent/news/author.js b/lib/routes/tencent/news/author.js new file mode 100644 index 0000000000..a5e9b8158c --- /dev/null +++ b/lib/routes/tencent/news/author.js @@ -0,0 +1,39 @@ +const got = require('@/utils/got'); + +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; + + const items = list.map((item) => { + const title = item.title; + const date = Date(item.timestamp); + const itemUrl = item.vurl; + const author = item.source; + const description = item.abstract; + + const single = { + title, + description, + link: itemUrl, + author, + pubDate: date, + }; + return single; + }); + ctx.state.data = { + title: title, + description: description, + link: link, + item: items, + }; +};