feat(route): weekendhk (#12011)

This commit is contained in:
Tony
2023-03-03 03:15:09 +08:00
committed by GitHub
parent a9d6957e60
commit 3d9783f044
5 changed files with 55 additions and 0 deletions
+6
View File
@@ -2270,6 +2270,12 @@ category 对应的关键词有
<Route author="Dustin-Jiang" example="/mrdx/today" path="/mrdx/today" />
## 新假期周刊
### 最新文章
<Route author="TonyRL" example="/weekendhk" path="/weekendhk" radar="1" rssbud="1" />
## 新京报
### 栏目
+4
View File
@@ -0,0 +1,4 @@
module.exports = {
'': ['TonyRL'],
'/': ['TonyRL'],
};
+29
View File
@@ -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,
};
};
+13
View File
@@ -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',
},
],
},
};
+3
View File
@@ -0,0 +1,3 @@
module.exports = (router) => {
router.get('/', require('./posts'));
};