feat(route): add 萌番组 (#10427)
* chore(deps): bump rand-user-agent from 1.0.74 to 1.0.76 (#254) Bumps [rand-user-agent](https://github.com/WebScrapingAPI/rand-user-agent) from 1.0.74 to 1.0.76. - [Release notes](https://github.com/WebScrapingAPI/rand-user-agent/releases) - [Commits](https://github.com/WebScrapingAPI/rand-user-agent/commits) --- updated-dependencies: - dependency-name: rand-user-agent dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps): bump puppeteer-extra-plugin-stealth from 2.11.0 to 2.11.1 (#256) Bumps [puppeteer-extra-plugin-stealth](https://github.com/berstend/puppeteer-extra) from 2.11.0 to 2.11.1. - [Release notes](https://github.com/berstend/puppeteer-extra/releases) - [Commits](https://github.com/berstend/puppeteer-extra/compare/puppeteer-extra-plugin-stealth@2.11.0...puppeteer-extra-plugin-stealth@2.11.1) --- updated-dependencies: - dependency-name: puppeteer-extra-plugin-stealth dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * feat(route): add 萌番组 * fix: radar Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
parent
57ba36bcd9
commit
b39ee6709e
|
|
@ -531,6 +531,20 @@ Sources
|
|||
|
||||
<Route author="junfengP" path="/manxiaosi/book/:id" example="/manxiaosi/book/90" :paramsDesc="['漫画id,漫画主页的地址栏中']" radar="1" rssbud="1"/>
|
||||
|
||||
## 萌番组
|
||||
|
||||
### 最新
|
||||
|
||||
<Route author="nczitzk" example="/bangumi" path="/bangumi"/>
|
||||
|
||||
### 标签
|
||||
|
||||
<Route author="nczitzk" example="/bangumi/简体中文/1080p" path="/bangumi/:tags?" :paramsDesc="['标签,默认为空,多个标签用 `/` 分隔']">
|
||||
|
||||
更多标签请前往 [搜索种子](https://bangumi.moe/search/index)
|
||||
|
||||
</Route>
|
||||
|
||||
## 三界异次元
|
||||
|
||||
### 三界异次元
|
||||
|
|
|
|||
|
|
@ -4,6 +4,20 @@ pageClass: routes
|
|||
|
||||
# ACG
|
||||
|
||||
## Bangumi Moe
|
||||
|
||||
### Latest
|
||||
|
||||
<RouteEn author="nczitzk" example="/bangumi" path="/bangumi"/>
|
||||
|
||||
### Tags
|
||||
|
||||
<RouteEn author="nczitzk" example="/bangumi/chs/1080p" path="/bangumi/:tags?" :paramsDesc="['Tags, empty by default, multiple tags separated by `/`']">
|
||||
|
||||
For more tags, please go to [Search torrent](https://bangumi.moe/search/index)
|
||||
|
||||
</RouteEn>
|
||||
|
||||
## Hanime.tv
|
||||
|
||||
### Recently updated
|
||||
|
|
|
|||
|
|
@ -0,0 +1,92 @@
|
|||
const got = require('@/utils/got');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const isLatest = ctx.path === '/';
|
||||
const rootUrl = 'https://bangumi.moe';
|
||||
|
||||
let response;
|
||||
let tag_id = [];
|
||||
|
||||
if (isLatest) {
|
||||
const apiUrl = `${rootUrl}/api/torrent/latest`;
|
||||
|
||||
response = await got({
|
||||
method: 'get',
|
||||
url: apiUrl,
|
||||
});
|
||||
} else {
|
||||
const tagUrl = `${rootUrl}/api/tag/search`;
|
||||
const torrentUrl = `${rootUrl}/api/torrent/search`;
|
||||
|
||||
const params = ctx.path.split('/').slice(1);
|
||||
|
||||
tag_id = await Promise.all(
|
||||
params.map((param) =>
|
||||
ctx.cache.tryGet(param, async () => {
|
||||
const paramResponse = await got({
|
||||
method: 'post',
|
||||
url: tagUrl,
|
||||
json: {
|
||||
name: decodeURIComponent(param),
|
||||
keywords: true,
|
||||
multi: true,
|
||||
},
|
||||
});
|
||||
|
||||
return paramResponse.data.found ? paramResponse.data.tag.map((tag) => tag._id)[0] : '';
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
response = await got({
|
||||
method: 'post',
|
||||
url: torrentUrl,
|
||||
json: {
|
||||
tag_id,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
let items =
|
||||
response.data.torrents?.slice(0, ctx.query.limit ? parseInt(ctx.query.limit) : 30).map((item) => ({
|
||||
title: item.title,
|
||||
link: `${rootUrl}/torrent/${item._id}`,
|
||||
description: item.introduction,
|
||||
pubDate: parseDate(item.publish_time),
|
||||
enclosure_url: item.magnet,
|
||||
enclosure_type: 'application/x-bittorrent',
|
||||
category: item.tag_ids,
|
||||
})) ?? [];
|
||||
|
||||
items = await Promise.all(
|
||||
items.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const detailResponse = await got({
|
||||
method: 'post',
|
||||
url: `${rootUrl}/api/tag/fetch`,
|
||||
json: {
|
||||
_ids: item.category,
|
||||
},
|
||||
});
|
||||
|
||||
item.category = [];
|
||||
|
||||
for (const tag of detailResponse.data) {
|
||||
for (const t of tag.synonyms) {
|
||||
item.category.push(t);
|
||||
}
|
||||
}
|
||||
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: '萌番组 Bangumi Moe',
|
||||
link: isLatest || items.length === 0 ? rootUrl : `${rootUrl}/search/${tag_id.join('+')}`,
|
||||
item: items,
|
||||
allowEmpty: true,
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
module.exports = {
|
||||
'/': ['nczitzk'],
|
||||
'/:tags?': ['nczitzk'],
|
||||
};
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
module.exports = {
|
||||
'萌番组 Bangumi Moe': {
|
||||
_name: 'bangumi.moe',
|
||||
'.': [
|
||||
{
|
||||
title: '最新',
|
||||
docs: 'https://docs.rsshub.app/anime.html#meng-fan-zu-zui-xin',
|
||||
source: ['/'],
|
||||
target: '/bangumi',
|
||||
},
|
||||
{
|
||||
title: '标签',
|
||||
docs: 'https://docs.rsshub.app/anime.html#meng-fan-zu-biao-qian',
|
||||
source: ['/search/index'],
|
||||
target: '/bangumi/:tags?',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get(/([\w-/]+)?/, require('./index'));
|
||||
};
|
||||
Loading…
Reference in New Issue