Skip to content

Commit

Permalink
feat(route): weekendhk (DIYgod#12011)
Browse files Browse the repository at this point in the history
  • Loading branch information
TonyRL authored Mar 2, 2023
1 parent a9d6957 commit 3d9783f
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/traditional-media.md
Original file line number Diff line number Diff line change
Expand Up @@ -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" />

## 新京报

### 栏目
Expand Down
4 changes: 4 additions & 0 deletions lib/v2/weekendhk/maintainer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
'': ['TonyRL'],
'/': ['TonyRL'],
};
29 changes: 29 additions & 0 deletions lib/v2/weekendhk/posts.js
Original file line number Diff line number Diff line change
@@ -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 changes: 13 additions & 0 deletions lib/v2/weekendhk/radar.js
Original file line number Diff line number Diff line change
@@ -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 changes: 3 additions & 0 deletions lib/v2/weekendhk/router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = (router) => {
router.get('/', require('./posts'));
};

0 comments on commit 3d9783f

Please sign in to comment.