feat(route): add アニメ新番組 (#10559)

* add アニメ新番組

* Delete and modify character symbols

* Using art-template

* Modify url hash

* Define art and path

* Change back to post method

* Modify the post method

* feat(route): add アニメ新番組

* fix: typo
This commit is contained in:
Devin 2022-08-23 02:45:19 +08:00 committed by GitHub
parent ac59559646
commit a072942c28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 48 additions and 2 deletions

View File

@ -652,3 +652,9 @@ Sources
### 最新汉化
<Route author="junfengP" example="/zdfx" path="/zdfx"/>
## アニメ新番組
### 當季新番
<Route author="devinmugen" example="/bangumi/online" path="/bangumi/online"/>

View File

@ -1,4 +1,5 @@
module.exports = {
'/online': ['devinmugen'],
'/': ['nczitzk'],
'/:tags?': ['nczitzk'],
};

26
lib/v2/bangumi/online.js Normal file
View File

@ -0,0 +1,26 @@
const got = require('@/utils/got');
const { art } = require('@/utils/render');
const path = require('path');
module.exports = async (ctx) => {
const url = 'https://bangumi.online/api/home';
const response = await got.post(url);
const list = response.data.data.list;
const items = list.map((item) => ({
title: `${item.title_zh} - 第 ${item.volume}`,
description: art(path.join(__dirname, 'templates/image.art'), {
src: `https:${item.cover}`,
alt: `${item.title_zh} - 第 ${item.volume}`,
}),
link: `https://bangumi.online/watch/${item.vid}`,
}));
ctx.state.data = {
title: 'アニメ新番組',
link: 'https://bangumi.online',
item: items,
};
};

View File

@ -1,6 +1,6 @@
module.exports = {
'萌番组 Bangumi Moe': {
_name: 'bangumi.moe',
'bangumi.moe': {
_name: '萌番組',
'.': [
{
title: '最新',
@ -16,4 +16,15 @@ module.exports = {
},
],
},
'bangumi.online': {
_name: 'アニメ新番組',
'.': [
{
title: '當季新番',
docs: 'https://docs.rsshub.app/anime.html#アニメ-xin-fan-zu-dang-ji-xin-fan',
source: ['/'],
target: '/bangumi/online',
},
],
},
};

View File

@ -1,3 +1,4 @@
module.exports = function (router) {
router.get('/online', require('./online'));
router.get(/([\w-/]+)?/, require('./index'));
};

View File

@ -0,0 +1 @@
<img src="{{ src }}" alt="{{ alt }}">