diff --git a/docs/traditional-media.md b/docs/traditional-media.md index 7e1ba65d3..d9e7228f8 100644 --- a/docs/traditional-media.md +++ b/docs/traditional-media.md @@ -2270,6 +2270,12 @@ category 对应的关键词有 +## 新假期周刊 + +### 最新文章 + + + ## 新京报 ### 栏目 diff --git a/lib/v2/weekendhk/maintainer.js b/lib/v2/weekendhk/maintainer.js new file mode 100644 index 000000000..13972819d --- /dev/null +++ b/lib/v2/weekendhk/maintainer.js @@ -0,0 +1,4 @@ +module.exports = { + '': ['TonyRL'], + '/': ['TonyRL'], +}; diff --git a/lib/v2/weekendhk/posts.js b/lib/v2/weekendhk/posts.js new file mode 100644 index 000000000..3b9b9a5a5 --- /dev/null +++ b/lib/v2/weekendhk/posts.js @@ -0,0 +1,29 @@ +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, + }; +}; diff --git a/lib/v2/weekendhk/radar.js b/lib/v2/weekendhk/radar.js new file mode 100644 index 000000000..e94c8d88b --- /dev/null +++ b/lib/v2/weekendhk/radar.js @@ -0,0 +1,13 @@ +module.exports = { + 'weekendhk.com': { + _name: '新假期周刊', + '.': [ + { + title: '最新文章', + docs: 'https://docs.rsshub.app/traditional-media.html#xin-jia-qi-zhou-kan', + source: ['/'], + target: '/weekendhk', + }, + ], + }, +}; diff --git a/lib/v2/weekendhk/router.js b/lib/v2/weekendhk/router.js new file mode 100644 index 000000000..f0f3bc19c --- /dev/null +++ b/lib/v2/weekendhk/router.js @@ -0,0 +1,3 @@ +module.exports = (router) => { + router.get('/', require('./posts')); +};