Files
RSSHub/lib/v2/hk01/hot.js
Fatpandac 2f9b999055 fix(route): hk01 get fulltext and refactor to V2 (#9937)
* fix(route): hk01 get fulltext and refactor to V2

* Update lib/v2/hk01/channel.js

Co-authored-by: Tony <TonyRL@users.noreply.github.com>

* Update lib/v2/hk01/issue.js

Co-authored-by: Tony <TonyRL@users.noreply.github.com>

* fix: teaser pubDate
2022-06-13 22:00:48 +08:00

22 lines
824 B
JavaScript

const got = require('@/utils/got');
const { parseDate } = require('@/utils/parse-date');
module.exports = async (ctx) => {
const response = await got('https://web-data.api.hk01.com/v2/page/hot/');
const data = response.data;
const list = data.items;
ctx.state.data = {
title: '香港01 - 熱門',
description: data.meta.metaDesc,
link: data.meta.canonicalUrl,
item: list.map((item) => ({
title: item.data.title,
author: item.data.authors && item.data.authors.map((e) => e.publishName).join(', '),
description: `<p>${item.data.description}</p><img style="width: 100%" src="${item.data.mainImage.cdnUrl}" />`,
pubDate: parseDate(item.data.lastModifyTime * 1000),
link: item.data.canonicalUrl,
})),
};
};