fix(route): Fix the BBC Chinese 404 page not found. (#13205)

* fix: BBC News rss fetching error

* refactor: migrate to v2

---------
This commit is contained in:
qyx596
2023-09-05 23:51:05 +08:00
committed by GitHub
parent 44aa011ff4
commit 54f7b4591e
7 changed files with 35 additions and 9 deletions
+1 -1
View File
@@ -442,7 +442,7 @@ router.get('/rs05/rs05', lazyloadRouteHandler('./routes/rs05/rs05'));
router.get('/qutoutiao/category/:cid', lazyloadRouteHandler('./routes/qutoutiao/category'));
// BBC
router.get('/bbc/:site?/:channel?', lazyloadRouteHandler('./routes/bbc/index'));
// router.get('/bbc/:site?/:channel?', lazyloadRouteHandler('./routes/bbc/index'));
// 看雪
router.get('/pediy/topic/:category?/:type?', lazyloadRouteHandler('./routes/pediy/topic'));
@@ -16,9 +16,9 @@ module.exports = async (ctx) => {
title = 'BBC News 中文网';
if (!channel) {
feed = await parser.parseURL('http://www.bbc.co.uk/zhongwen/simp/index.xml');
feed = await parser.parseURL('https://www.bbc.co.uk/zhongwen/simp/index.xml');
} else {
feed = await parser.parseURL(`http://www.bbc.co.uk/zhongwen/simp/${channel}/index.xml`);
feed = await parser.parseURL(`https://www.bbc.co.uk/zhongwen/simp/${channel}/index.xml`);
}
break;
@@ -26,9 +26,9 @@ module.exports = async (ctx) => {
title = 'BBC News 中文網';
if (!channel) {
feed = await parser.parseURL('http://www.bbc.co.uk/zhongwen/trad/index.xml');
feed = await parser.parseURL('https://www.bbc.co.uk/zhongwen/trad/index.xml');
} else {
feed = await parser.parseURL(`http://www.bbc.co.uk/zhongwen/trad/${channel}/index.xml`);
feed = await parser.parseURL(`https://www.bbc.co.uk/zhongwen/trad/${channel}/index.xml`);
}
link = 'https://www.bbc.com/zhongwen/trad';
break;
+4
View File
@@ -0,0 +1,4 @@
module.exports = {
'/:channel': ['HenryQW', 'DIYgod'],
'/:lang/:channel?': ['HenryQW'],
};
+11
View File
@@ -0,0 +1,11 @@
module.exports = {
'bbc.com': {
_name: 'BBC',
'.': [
{
title: 'News',
docs: 'https://docs.rsshub.app/routes/traditional-media#bbc',
},
],
},
};
+3
View File
@@ -0,0 +1,3 @@
module.exports = (router) => {
router.get('/:site?/:channel?', require('./index'));
};
+12 -4
View File
@@ -124,7 +124,7 @@ There is no RSS source for Al Jazeera Chinese, returning homepage content by def
## BBC {#bbc}
### BBC {#bbc-bbc}
### News {#bbc-news}
<Route author="HenryQW DIYgod" example="/bbc/world-asia" path="/bbc/:channel?" paramsDesc={['channel, default to `top stories`']}>
@@ -136,11 +136,19 @@ Support major channels, refer to [BBC RSS feeds](https://www.bbc.co.uk/news/1062
</Route>
### BBC Chinese {#bbc-bbc-chinese}
### BBC 中文网 {#bbc-bbc-zhong-wen-wang}
<Route author="HenryQW" example="/bbc/chinese/business" path="/bbc/:lang/:channel?" paramsDesc={['lang, Simplified or Traditional Chinese','channel, default to `top stories`']}>
<Route author="HenryQW" example="/bbc/chinese/business" path="/bbc/:lang/:channel?" paramsDesc={['语言,简体或繁体中文','频道,默认为主页']}>
See [BBC 中文网](/routes/traditional-media#bbc-bbc-zhong-wen-wang).
支持大部分频道,频道名称见 [BBC 中文网 RSS 服务](https://www.bbc.com/zhongwen/simp/services/2009/09/000000_rss)。
简体版:
- 频道,如金融财经 `https://www.bbc.co.uk/zhongwen/simp/business/index.xml` 则为 `/bbc/chinese/business`.
繁體版:
- 频道,如金融財經 `https://www.bbc.co.uk/zhongwen/trad/business/index.xml` 则为 `/bbc/traditionalchinese/business`.
</Route>