mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-10 07:12:51 +08:00
feat(route): add bgmlist (#12220)
* feat(route): add bgmlist * fix(route): bgmlist Co-authored-by: Tony <TonyRL@users.noreply.github.com> --------- Co-authored-by: Tony <TonyRL@users.noreply.github.com>
This commit is contained in:
@@ -616,6 +616,12 @@ Sources
|
||||
|
||||
<Route author="KellyHwong" path="/cartoonmad/comic/:id" example="/cartoonmad/comic/5827" :paramsDesc="['漫画ID']" radar="1"/>
|
||||
|
||||
## 番组放送
|
||||
|
||||
### 开播提醒
|
||||
|
||||
<Route author="x2cf" example="/bgmlist/onair/zh-Hans" path="/bgmlist/onair/:lang?" :paramsDesc="['语言']" radar="1" rssbud="1" />
|
||||
|
||||
## 风之动漫
|
||||
|
||||
### 在线漫画
|
||||
|
||||
3
lib/v2/bgmlist/maintainer.js
Normal file
3
lib/v2/bgmlist/maintainer.js
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
'/onair/:lang?': ['x2cf'],
|
||||
};
|
||||
33
lib/v2/bgmlist/onair.js
Normal file
33
lib/v2/bgmlist/onair.js
Normal file
@@ -0,0 +1,33 @@
|
||||
const got = require('@/utils/got');
|
||||
const path = require('path');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const { art } = require('@/utils/render');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { lang } = ctx.params;
|
||||
const siteLink = 'https://bgmlist.com/api/v1/bangumi/site';
|
||||
const sites = await ctx.cache.tryGet(siteLink, async () => (await got(siteLink)).data);
|
||||
const { data } = await got('https://bgmlist.com/api/v1/bangumi/onair');
|
||||
|
||||
ctx.state.data = {
|
||||
title: '番组放送 开播提醒',
|
||||
link: 'https://bgmlist.com/',
|
||||
item: data.items.map((item) => {
|
||||
item.sites.push({ site: 'dmhy', id: item.titleTranslate['zh-Hans']?.[0] ?? item.title });
|
||||
return {
|
||||
title: item.titleTranslate[lang]?.[0] ?? item.title,
|
||||
link: item.officialSite,
|
||||
description: art(
|
||||
path.join(__dirname, 'templates/description.art'),
|
||||
item.sites.map((site) => ({
|
||||
title: sites[site.site].title,
|
||||
url: sites[site.site].urlTemplate.replaceAll('{{id}}', site.id),
|
||||
begin: site.begin,
|
||||
}))
|
||||
),
|
||||
pubDate: parseDate(item.begin),
|
||||
guid: item.id,
|
||||
};
|
||||
}),
|
||||
};
|
||||
};
|
||||
13
lib/v2/bgmlist/radar.js
Normal file
13
lib/v2/bgmlist/radar.js
Normal file
@@ -0,0 +1,13 @@
|
||||
module.exports = {
|
||||
'bgmlist.com': {
|
||||
_name: '番组放送',
|
||||
'.': [
|
||||
{
|
||||
title: '开播提醒',
|
||||
docs: 'https://docs.rsshub.app/anime.html#fan-zu-fang-song',
|
||||
source: ['/'],
|
||||
target: '/bgmlist/onair/zh-Hans',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
3
lib/v2/bgmlist/router.js
Normal file
3
lib/v2/bgmlist/router.js
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = (router) => {
|
||||
router.get('/onair/:lang?', require('./onair'));
|
||||
};
|
||||
4
lib/v2/bgmlist/templates/description.art
Normal file
4
lib/v2/bgmlist/templates/description.art
Normal file
@@ -0,0 +1,4 @@
|
||||
{{each}}
|
||||
<a href="{{$value.url}}">{{$value.title}}</a>{{if $value.begin}}(开播时间:{{$value.begin}}){{/if}}
|
||||
<br>
|
||||
{{/each}}
|
||||
Reference in New Issue
Block a user