RSSHub/lib/v2/weekendhk/posts.js

30 lines
1.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const got = require('@/utils/got');
const { parseDate } = require('@/utils/parse-date');
module.exports = async (ctx) => {
const baseUrl = 'https://www.weekendhk.com';
const response = await got(`${baseUrl}/wp-json/wp/v2/posts`, {
searchParams: {
per_page: ctx.query.limit ?? 100,
},
});
const items = response.data.map((item) => ({
title: item.title.rendered,
link: item.link,
guid: item.guid.rendered,
description: item.content.rendered,
pubDate: parseDate(item.date_gmt),
author: item.creator_editor,
}));
ctx.state.data = {
title: '新假期周刊',
description: '新假期周刊網站為全港最強吃喝玩樂搵節目平台。網羅世界各地最詳盡旅遊潮流資訊最新鮮熱辣本地飲食情報最好玩周末玩樂節目即時瞓身報導全天候為你update。',
link: baseUrl,
language: 'zh-HK',
image: `${baseUrl}/wp-content/themes/bucket/theme-content/images/196x196.png`,
item: items,
};
};