fix(route): fix the error of route hk01/channel when channel does not have publishName (#12152)
* Fix hk01/channel when channel does not have publishName * additional fix to the same problem * Add(route): hk01 latest * Fix radar * docs: fix category ---------
This commit is contained in:
parent
dbd6ac73ca
commit
952b0b7115
|
|
@ -4205,6 +4205,32 @@ wechat-feeds 来源[已停止更新](https://github.com/hellodword/wechat-feeds/
|
|||
|
||||
</Route>
|
||||
|
||||
## 香港 01
|
||||
|
||||
### 热门
|
||||
|
||||
<Route author="hoilc Fatpandac nczitzk" example="/hk01/hot" path="/hk01/hot" radar="1" rssbud="1"/>
|
||||
|
||||
### 栏目
|
||||
|
||||
<Route author="hoilc Fatpandac nczitzk" example="/hk01/zone/11" path="/hk01/zone/:id" :paramsDesc="['栏目 id, 可在 URL 中找到']" radar="1" rssbud="1"/>
|
||||
|
||||
### 子栏目
|
||||
|
||||
<Route author="hoilc Fatpandac nczitzk" example="/hk01/channel/391" path="/hk01/channel/:id" :paramsDesc="['子栏目 id, 可在 URL 中找到']" radar="1" rssbud="1"/>
|
||||
|
||||
### 专题
|
||||
|
||||
<Route author="hoilc Fatpandac nczitzk" example="/hk01/issue/649" path="/hk01/issue/:id" :paramsDesc="['专题 id, 可在 URL 中找到']" radar="1" rssbud="1"/>
|
||||
|
||||
### 标签
|
||||
|
||||
<Route author="hoilc Fatpandac nczitzk" example="/hk01/tag/2787" path="/hk01/tag/:id" :paramsDesc="['标签 id, 可在 URL 中找到']" radar="1" rssbud="1"/>
|
||||
|
||||
### 即時
|
||||
|
||||
<Route author="5upernove-heng" example="/hk01/latest" path="/hk01/latest" radar="1" rssbud="1"/>
|
||||
|
||||
## 香港高登
|
||||
|
||||
### 頻道
|
||||
|
|
|
|||
|
|
@ -2217,28 +2217,6 @@ category 对应的关键词有
|
|||
|
||||
</Route>
|
||||
|
||||
## 香港 01
|
||||
|
||||
### 热门
|
||||
|
||||
<Route author="hoilc Fatpandac nczitzk" example="/hk01/hot" path="/hk01/hot" radar="1" rssbud="1"/>
|
||||
|
||||
### 栏目
|
||||
|
||||
<Route author="hoilc Fatpandac nczitzk" example="/hk01/zone/11" path="/hk01/zone/:id" :paramsDesc="['栏目 id, 可在 URL 中找到']" radar="1" rssbud="1"/>
|
||||
|
||||
### 子栏目
|
||||
|
||||
<Route author="hoilc Fatpandac nczitzk" example="/hk01/channel/391" path="/hk01/channel/:id" :paramsDesc="['子栏目 id, 可在 URL 中找到']" radar="1" rssbud="1"/>
|
||||
|
||||
### 专题
|
||||
|
||||
<Route author="hoilc Fatpandac nczitzk" example="/hk01/issue/649" path="/hk01/issue/:id" :paramsDesc="['专题 id, 可在 URL 中找到']" radar="1" rssbud="1"/>
|
||||
|
||||
### 标签
|
||||
|
||||
<Route author="hoilc Fatpandac nczitzk" example="/hk01/tag/2787" path="/hk01/tag/:id" :paramsDesc="['标签 id, 可在 URL 中找到']" radar="1" rssbud="1"/>
|
||||
|
||||
## 香港電台
|
||||
|
||||
### 新聞
|
||||
|
|
|
|||
|
|
@ -15,9 +15,9 @@ module.exports = async (ctx) => {
|
|||
const items = await ProcessItems(response.data.items, ctx.query.limit, ctx.cache.tryGet);
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${response.data.category.publishName} | 香港01`,
|
||||
title: response.data.category ? `${response.data.category.publishName} | 香港01` : `Channel: ${id} | 香港01`,
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
image: response.data.category.icon,
|
||||
image: response.data.category ? response.data.category.icon : null,
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
const got = require('@/utils/got');
|
||||
const { rootUrl, apiRootUrl, ProcessItems } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const currentUrl = `${rootUrl}/latest`;
|
||||
const apiUrl = `${apiRootUrl}/v2/page/latest`;
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: apiUrl,
|
||||
});
|
||||
|
||||
const items = await ProcessItems(response.data.items, ctx.query.limit, ctx.cache.tryGet);
|
||||
|
||||
ctx.state.data = {
|
||||
title: '即時 | 香港01',
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
module.exports = {
|
||||
'/channel/:id': ['hoilc', 'Fatpandac', 'nczitzk'],
|
||||
'/hot': ['hoilc', 'Fatpandac', 'nczitzk'],
|
||||
'/latest': ['5upernova-heng'],
|
||||
'/issue/:id': ['hoilc', 'Fatpandac', 'nczitzk'],
|
||||
'/tag/:id': ['hoilc', 'Fatpandac', 'nczitzk'],
|
||||
'/zone/:id': ['hoilc', 'Fatpandac', 'nczitzk'],
|
||||
|
|
|
|||
|
|
@ -4,34 +4,40 @@ module.exports = {
|
|||
'.': [
|
||||
{
|
||||
title: '热门',
|
||||
docs: 'https://docs.rsshub.app/traditional-media.html#xiang-gang-01-re-men',
|
||||
docs: 'https://docs.rsshub.app/new-media.html#xiang-gang-01-re-men',
|
||||
source: ['/hot', '/'],
|
||||
target: '/hk01/hot',
|
||||
},
|
||||
{
|
||||
title: '栏目',
|
||||
docs: 'https://docs.rsshub.app/traditional-media.html#xiang-gang-01-lan-mu',
|
||||
docs: 'https://docs.rsshub.app/new-media.html#xiang-gang-01-lan-mu',
|
||||
source: ['/zone/:id', '/'],
|
||||
target: '/hk01/zone/:id?',
|
||||
},
|
||||
{
|
||||
title: '子栏目',
|
||||
docs: 'https://docs.rsshub.app/traditional-media.html#xiang-gang-01-zi-lan-mu',
|
||||
docs: 'https://docs.rsshub.app/new-media.html#xiang-gang-01-zi-lan-mu',
|
||||
source: ['/channel/:id', '/'],
|
||||
target: '/hk01/channel/:id?',
|
||||
},
|
||||
{
|
||||
title: '专题',
|
||||
docs: 'https://docs.rsshub.app/traditional-media.html#xiang-gang-01-zhuan-ti',
|
||||
docs: 'https://docs.rsshub.app/new-media.html#xiang-gang-01-zhuan-ti',
|
||||
source: ['/issue/:id', '/'],
|
||||
target: '/hk01/issue/:id?',
|
||||
},
|
||||
{
|
||||
title: '标签',
|
||||
docs: 'https://docs.rsshub.app/traditional-media.html#xiang-gang-01-biao-qian',
|
||||
docs: 'https://docs.rsshub.app/new-media.html#xiang-gang-01-biao-qian',
|
||||
source: ['/tag/:id', '/'],
|
||||
target: '/hk01/tag/:id?',
|
||||
},
|
||||
{
|
||||
title: '即時',
|
||||
docs: 'https://docs.rsshub.app/new-media.html#xiang-gang-01-ji-shi',
|
||||
source: ['/latest', '/'],
|
||||
target: '/hk01/latest',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ module.exports = function (router) {
|
|||
router.get('/channel/:id?', require('./channel'));
|
||||
router.get('/hot', require('./hot'));
|
||||
router.get('/issue/:id?', require('./issue'));
|
||||
router.get('/latest', require('./latest'));
|
||||
router.get('/tag/:id?', require('./tag'));
|
||||
router.get('/zone/:id?', require('./zone'));
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue