From 54f7b4591e7f3343f97bee6d21546310a59d154e Mon Sep 17 00:00:00 2001 From: qyx596 Date: Tue, 5 Sep 2023 10:51:05 -0500 Subject: [PATCH] fix(route): Fix the BBC Chinese 404 page not found. (#13205) * fix: BBC News rss fetching error * refactor: migrate to v2 --------- --- lib/router.js | 2 +- lib/{routes => v2}/bbc/index.js | 8 ++++---- lib/v2/bbc/maintainer.js | 4 ++++ lib/v2/bbc/radar.js | 11 +++++++++++ lib/v2/bbc/router.js | 3 +++ lib/{routes => v2}/bbc/utils.js | 0 website/docs/routes/traditional-media.md | 16 ++++++++++++---- 7 files changed, 35 insertions(+), 9 deletions(-) rename lib/{routes => v2}/bbc/index.js (86%) create mode 100644 lib/v2/bbc/maintainer.js create mode 100644 lib/v2/bbc/radar.js create mode 100644 lib/v2/bbc/router.js rename lib/{routes => v2}/bbc/utils.js (100%) diff --git a/lib/router.js b/lib/router.js index 6d1ce134a6b8e6..4a818131d90578 100644 --- a/lib/router.js +++ b/lib/router.js @@ -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')); diff --git a/lib/routes/bbc/index.js b/lib/v2/bbc/index.js similarity index 86% rename from lib/routes/bbc/index.js rename to lib/v2/bbc/index.js index 71fb375aacb4f9..acb02c637aec30 100644 --- a/lib/routes/bbc/index.js +++ b/lib/v2/bbc/index.js @@ -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; diff --git a/lib/v2/bbc/maintainer.js b/lib/v2/bbc/maintainer.js new file mode 100644 index 00000000000000..485c161be01cc9 --- /dev/null +++ b/lib/v2/bbc/maintainer.js @@ -0,0 +1,4 @@ +module.exports = { + '/:channel': ['HenryQW', 'DIYgod'], + '/:lang/:channel?': ['HenryQW'], +}; diff --git a/lib/v2/bbc/radar.js b/lib/v2/bbc/radar.js new file mode 100644 index 00000000000000..8a61aadc53706b --- /dev/null +++ b/lib/v2/bbc/radar.js @@ -0,0 +1,11 @@ +module.exports = { + 'bbc.com': { + _name: 'BBC', + '.': [ + { + title: 'News', + docs: 'https://docs.rsshub.app/routes/traditional-media#bbc', + }, + ], + }, +}; diff --git a/lib/v2/bbc/router.js b/lib/v2/bbc/router.js new file mode 100644 index 00000000000000..d0b16d259d2d79 --- /dev/null +++ b/lib/v2/bbc/router.js @@ -0,0 +1,3 @@ +module.exports = (router) => { + router.get('/:site?/:channel?', require('./index')); +}; diff --git a/lib/routes/bbc/utils.js b/lib/v2/bbc/utils.js similarity index 100% rename from lib/routes/bbc/utils.js rename to lib/v2/bbc/utils.js diff --git a/website/docs/routes/traditional-media.md b/website/docs/routes/traditional-media.md index 3aa4b9d8f1386c..be1c56501af22d 100644 --- a/website/docs/routes/traditional-media.md +++ b/website/docs/routes/traditional-media.md @@ -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} @@ -136,11 +136,19 @@ Support major channels, refer to [BBC RSS feeds](https://www.bbc.co.uk/news/1062 -### BBC Chinese {#bbc-bbc-chinese} +### BBC 中文网 {#bbc-bbc-zhong-wen-wang} - + -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`.