feat(route): add Radio-Canada.ca latest news (#8275)
* feat(route): add Radio-Canada.ca latest news * fix typo * fix typo * update lib/v2/radio-canada/radar.js Co-authored-by: Tony <TonyRL@users.noreply.github.com> * update docs/en/new-media.md Co-authored-by: Tony <TonyRL@users.noreply.github.com> * update docs/new-media.md Co-authored-by: Tony <TonyRL@users.noreply.github.com> Co-authored-by: Tony <TonyRL@users.noreply.github.com>
This commit is contained in:
parent
d4353a83a0
commit
369d2902e8
|
|
@ -494,6 +494,18 @@ Compared to the official one, this feed:
|
|||
|
||||
</RouteEn>
|
||||
|
||||
## Radio-Canada.ca
|
||||
|
||||
### Latest News
|
||||
|
||||
<RouteEn author="nczitzk" example="/radio-canada/latest" path="/radio-canada/latest/:language?" :paramsDesc="['Language, see below, English by default']">
|
||||
|
||||
| Français | English | Español | 简体中文 | 繁體中文 | العربية | ਪੰਜਾਬੀ | Tagalog |
|
||||
| -------- | ------- | ------- | -------- | -------- | ------- | ------ | ------- |
|
||||
| fr | en | es | zh-hans | zh-hant | ar | pa | tl |
|
||||
|
||||
</RouteEn>
|
||||
|
||||
## Research Gate
|
||||
|
||||
### Publications
|
||||
|
|
|
|||
|
|
@ -1858,6 +1858,18 @@ others = 热点新闻 + 滚动新闻
|
|||
|
||||
</Route>
|
||||
|
||||
## 加拿大国际广播电台
|
||||
|
||||
### 最新消息
|
||||
|
||||
<Route author="nczitzk" example="/radio-canada/latest" path="/radio-canada/latest/:language?" :paramsDesc="['语言,见下表,默认为 English']">
|
||||
|
||||
| Français | English | Español | 简体中文 | 繁體中文 | العربية | ਪੰਜਾਬੀ | Tagalog |
|
||||
| -------- | ------- | ------- | -------- | -------- | ------- | ------ | ------- |
|
||||
| fr | en | es | zh-hans | zh-hant | ar | pa | tl |
|
||||
|
||||
</Route>
|
||||
|
||||
## 贾真的电商 108 将
|
||||
|
||||
### 「108 将」实战分享
|
||||
|
|
|
|||
|
|
@ -0,0 +1,43 @@
|
|||
const got = require('@/utils/got');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const language = ctx.params.language ?? 'en';
|
||||
|
||||
const rootUrl = 'https://ici.radio-canada.ca';
|
||||
const apiRootUrl = 'https://services.radio-canada.ca';
|
||||
const currentUrl = `${apiRootUrl}/neuro/sphere/v1/rci/${language}/continuous-feed?pageSize=50`;
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: currentUrl,
|
||||
});
|
||||
|
||||
const list = response.data.data.lineup.items.map((item) => ({
|
||||
title: item.title,
|
||||
category: item.kicker,
|
||||
link: `${rootUrl}${item.url}`,
|
||||
pubDate: parseDate(item.date),
|
||||
}));
|
||||
|
||||
const items = await Promise.all(
|
||||
list.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const detailResponse = await got({
|
||||
method: 'get',
|
||||
url: item.link,
|
||||
});
|
||||
|
||||
item.description = detailResponse.data.match(/"body":{"html":"(.*)","attachments"/)[1].replace(/\\n/g, '');
|
||||
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: response.data.meta.title,
|
||||
link: response.data.metric.metrikContent.omniture.url,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
'/latest/:language?': ['nczitzk'],
|
||||
};
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
module.exports = {
|
||||
'ici.radio-canada.ca': {
|
||||
_name: 'Radio Canada',
|
||||
'.': [
|
||||
{
|
||||
title: 'Latest News',
|
||||
docs: 'https://docs.rsshub.app/new-media.html#jia-na-da-guo-ji-guang-bo-dian-tai-zui-xin-xiao-xi',
|
||||
source: ['/rci/:lang', '/'],
|
||||
target: '/radio-canada/latest/:language?',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get('/latest/:language?', require('./latest'));
|
||||
};
|
||||
Loading…
Reference in New Issue