mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
fix(route): 鱼塘热榜修复与优化 (#9214)
* fix: 鱼塘热榜图片显示,日期错误 * fix: use parseDate util * fix: use single quotes * fix: art template * update: gif file extension
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
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 id = ctx.params.id;
|
||||
@@ -13,17 +16,26 @@ module.exports = async (ctx) => {
|
||||
|
||||
const data = response.data.Data.data;
|
||||
|
||||
const title = `鱼塘热榜`;
|
||||
const title = '鱼塘热榜';
|
||||
|
||||
ctx.state.data = {
|
||||
title,
|
||||
link: `https://mo.fish/`,
|
||||
description: title,
|
||||
item: data.map((item) => ({
|
||||
title: item.Title,
|
||||
pubDate: new Date(item.releaseTime).toUTCString(),
|
||||
link: item.Url,
|
||||
guid: item.id,
|
||||
})),
|
||||
link: 'https://mo.fish/',
|
||||
item: data.map((item) => {
|
||||
const isImage = Number(id) === 136 && item.Url.endsWith('.gif');
|
||||
const description = isImage
|
||||
? art(path.join(__dirname, 'templates/description.art'), {
|
||||
imageUrl: item.Url,
|
||||
})
|
||||
: title;
|
||||
|
||||
return {
|
||||
title: item.Title,
|
||||
description,
|
||||
pubDate: parseDate(item.CreateTime * 1000),
|
||||
link: item.Url,
|
||||
guid: item.id,
|
||||
};
|
||||
}),
|
||||
};
|
||||
};
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<p>
|
||||
<img src="{{ imageUrl }}" referrerpolicy="no-referrer">
|
||||
<br>
|
||||
</p>
|
||||
Reference in New Issue
Block a user