mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-10-24 02:08:55 +08:00
feat: 添加快知 (#3184)
This commit is contained in:
@@ -417,6 +417,12 @@ pageClass: routes
|
||||
|
||||
<Route author="kt286" example="/kkj/news" path="/kkj/news"/>
|
||||
|
||||
## 快知
|
||||
|
||||
### 话题
|
||||
|
||||
<Route author="hoilc" example="/kzfeed/topic/KklZRd9a04OgA" path="/kzfeed/topic/:id" :paramsDesc="['话题ID, 可以从话题URL中获得']"/>
|
||||
|
||||
## 老司机
|
||||
|
||||
### 首页
|
||||
|
||||
@@ -1783,6 +1783,9 @@ router.get('/watchface/:watch_type?/:list_type?', require('./routes/watchface/up
|
||||
router.get('/cnu/selected', require('./routes/cnu/selected'));
|
||||
router.get('/cnu/discovery/:type?/:category?', require('./routes/cnu/discovery'));
|
||||
|
||||
// 快知
|
||||
router.get('/kzfeed/topic/:id', require('./routes/kzfeed/topic'));
|
||||
|
||||
// 腾讯新闻较真查证平台
|
||||
router.get('/factcheck', require('./routes/tencent/factcheck'));
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
|
||||
const info_res = await got({
|
||||
method: 'post',
|
||||
url: 'https://kz.sync163.com/api/topic/info',
|
||||
headers: {
|
||||
from: 'h5',
|
||||
token: 'asdfasdfasdf',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
data: JSON.stringify({
|
||||
topic_id: id,
|
||||
}),
|
||||
});
|
||||
const info = info_res.data;
|
||||
|
||||
const cards_res = await got({
|
||||
method: 'post',
|
||||
url: 'https://kz.sync163.com/api/topic/cards',
|
||||
headers: {
|
||||
from: 'h5',
|
||||
token: 'asdfasdfasdf',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
data: JSON.stringify({
|
||||
topic_id: id,
|
||||
}),
|
||||
});
|
||||
const list = cards_res.data.list;
|
||||
|
||||
ctx.state.data = {
|
||||
title: `快知 - ${info.info.name}`,
|
||||
description: info.info.description,
|
||||
link: `https://kz.sync163.com/web/topic/${id}`,
|
||||
image: info.info.icon,
|
||||
item: list.map((item) => ({
|
||||
title: item.title ? item.title : item.url_title,
|
||||
description: `<p>${item.text}</p><img src="${item.url_cover}" /><p>${item.url_desc}…</p>`,
|
||||
pubDate: new Date(item.created_time * 1000),
|
||||
link: item.url,
|
||||
})),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user