mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
feat(route): add 虎嗅24小时 (#10560)
This commit is contained in:
@@ -2274,6 +2274,10 @@ others = 热点新闻 + 滚动新闻
|
||||
|
||||
<Route author="HenryQW" example="/huxiu/article" path="/huxiu/article" />
|
||||
|
||||
### 24 小时
|
||||
|
||||
<Route author="nczitzk" example="/huxiu/moment" path="/huxiu/moment" />
|
||||
|
||||
### 标签
|
||||
|
||||
<Route author="xyqfer HenryQW" example="/huxiu/tag/291" path="/huxiu/tag/:id" :paramsDesc="['标签 id']" />
|
||||
|
||||
@@ -2,6 +2,7 @@ module.exports = {
|
||||
'/article': ['HenryQW'],
|
||||
'/author/:id': ['HenryQW'],
|
||||
'/collection/:id': ['AlexdanerZe'],
|
||||
'/moment': ['nczitzk'],
|
||||
'/tag/:id': ['xyqfer', 'HenryQW'],
|
||||
'/search/:keyword': ['xyqfer', 'HenryQW'],
|
||||
};
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
const got = require('@/utils/got');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const { art } = require('@/utils/render');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const rootUrl = 'https://www.huxiu.com';
|
||||
const currentUrl = `${rootUrl}/moment`;
|
||||
const apiRootUrl = 'https://moment-api.huxiu.com';
|
||||
const apiUrl = `${apiRootUrl}/web-v2/moment/feed`;
|
||||
|
||||
const response = await got({
|
||||
method: 'post',
|
||||
url: apiUrl,
|
||||
form: {
|
||||
last_dateline: parseInt(new Date().getTime() / 1000),
|
||||
platform: 'www',
|
||||
is_ai: 0,
|
||||
},
|
||||
});
|
||||
|
||||
const items = response.data.data.moment_list.datalist[0].datalist.map((item) => ({
|
||||
title: item.content,
|
||||
link: item.share_url,
|
||||
author: item.user_info.username,
|
||||
pubDate: parseDate(item.publish_time * 1000),
|
||||
description: art(path.join(__dirname, 'templates/moment.art'), {
|
||||
description: item.content,
|
||||
images: item.img_urls,
|
||||
video: item.video,
|
||||
comments: item.comment,
|
||||
}),
|
||||
}));
|
||||
|
||||
ctx.state.data = {
|
||||
title: '虎嗅 - 24小时',
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
@@ -8,6 +8,12 @@ module.exports = {
|
||||
source: ['/article', '/'],
|
||||
target: '/huxiu/article',
|
||||
},
|
||||
{
|
||||
title: '24小时',
|
||||
docs: 'https://docs.rsshub.app/new-media.html#hu-xiu',
|
||||
source: ['/moment', '/'],
|
||||
target: '/huxiu/moment',
|
||||
},
|
||||
{
|
||||
title: '标签',
|
||||
docs: 'https://docs.rsshub.app/new-media.html#hu-xiu',
|
||||
|
||||
@@ -2,6 +2,7 @@ module.exports = (router) => {
|
||||
router.get('/article', require('./article'));
|
||||
router.get('/author/:id', require('./author'));
|
||||
router.get('/collection/:id', require('./collection'));
|
||||
router.get('/moment', require('./moment'));
|
||||
router.get('/tag/:id', require('./tag'));
|
||||
router.get('/search/:keyword', require('./search'));
|
||||
};
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
{{@ description }}
|
||||
{{ if images }}
|
||||
{{ each images image }}
|
||||
<img src="{{ image.origin_pic }}" width="{{ image.origin_width }}" height="{{ image.origin_height }}">
|
||||
{{ /each }}
|
||||
{{ /if }}
|
||||
{{ if video }}
|
||||
<video width="{{ video.width }}" height="{{ video.height }}" poster="{{ video.cover_path }}" controls>
|
||||
<source src="{{ video.url }}" type="video/{{ video.format }}">
|
||||
</video>
|
||||
{{ /if }}
|
||||
{{ if comments }}
|
||||
{{ each comments.datalist comment }}
|
||||
<p>{{ comment.user_info.username }}: {{ comment.content }} ({{ comment.show_time }})</p>
|
||||
{{ /each }}
|
||||
{{ /if }}
|
||||
Reference in New Issue
Block a user