feat(route): add comicat 漫喵动漫BT下载 (#12545)
* feat(route): add comicat 漫喵动漫BT下载 * fix(route): comicat 漫喵动漫BT下载 * fix(route): comicat 漫喵动漫BT下载 typo * fix(route): comicat 漫喵动漫BT下载 fix wrong items * fix(route): comicat 漫喵动漫BT下载 fix radar * fix(route): comicat 漫喵动漫BT下载 fix docs uri * fix(route): comicat 漫喵动漫BT下载 修改了 docs 路径 * fix(route): comicat 漫喵动漫BT下载 * fix(route): comicat 漫喵动漫BT下载 fix radar * fix(route): comicat 漫喵动漫BT下载 * Update lib/v2/comicat/maintainer.js Co-authored-by: Tony <TonyRL@users.noreply.github.com> * Update docs/anime.md Co-authored-by: Tony <TonyRL@users.noreply.github.com> * Update lib/v2/comicat/search.js Co-authored-by: Tony <TonyRL@users.noreply.github.com> * Update lib/v2/comicat/search.js use enclosure in item * Update lib/v2/comicat/search.js fix doc example and move item puDate into item level * Update lib/v2/comicat/search.js ---------
This commit is contained in:
parent
cbca59f390
commit
39c3d5f277
|
|
@ -191,6 +191,12 @@ pageClass: routes
|
|||
|
||||
<Route author="TonyRL" example="/creative-comic/book/117" path="/creative-comic/book/:id/:coverOnly?/:quality?" :paramsDesc="['漫畫 ID,可在 URL 中找到', '僅獲取封面,非 `true` 時將獲取**全部**頁面,預設 `true`', '閱讀品質,標準畫質 `1`,高畫質 `2`,預設 `1`']" radar="1" rssbud="1"/>
|
||||
|
||||
## Comicat
|
||||
|
||||
### 搜索关键词
|
||||
|
||||
<Route author="Cyang39" example="/comicat/search/喵萌奶茶屋+跃动青春+720P+简日" path="/comicat/search/:keyword" :paramsDesc="['关键词,请用`+`号连接']" supportBT=1/>
|
||||
|
||||
## CnGal
|
||||
|
||||
### 每周速报
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
'/search/:keyword': ['Cyang39'],
|
||||
};
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
module.exports = {
|
||||
'comicat.org': {
|
||||
_name: 'Comicat',
|
||||
'.': [
|
||||
{
|
||||
title: '搜索关键词',
|
||||
docs: 'https://docs.rsshub.app/anime.html#comicat',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get('/search/:keyword', require('./search'));
|
||||
};
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
const baseUrl = 'https://comicat.org';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const keyword = ctx.params.keyword;
|
||||
const { data: response } = await got(`${baseUrl}/search.php?keyword=${encodeURIComponent(keyword)}`);
|
||||
const $ = cheerio.load(response);
|
||||
const list = $('#listTable tbody > tr')
|
||||
.toArray()
|
||||
.map((item) => ({
|
||||
title: $(item).find('td:nth-child(3)').text().trim(),
|
||||
link: `${baseUrl}/${$(item).find('td:nth-child(3) a').attr('href')}`,
|
||||
category: $(item).find('td:nth-child(2)').text().trim(),
|
||||
author: $(item).find('td:nth-child(8)').text().trim(),
|
||||
}));
|
||||
|
||||
const items = await Promise.all(
|
||||
list.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const { data: response } = await got(item.link);
|
||||
const $ = cheerio.load(response);
|
||||
|
||||
item.pubDate = parseDate($('div.main > div.slayout > div > div.c1 > div:nth-child(1) > div > p:nth-child(4)').text().split('发布时间: ')[1]);
|
||||
const marginLink = `magnet:?xt=urn:btih:${$('#text_hash_id').text().split(',特征码:')[1]}`.trim();
|
||||
item.enclosure_url = marginLink;
|
||||
item.enclosure_type = 'application/x-bittorrent';
|
||||
item.description = $('#btm > div.main > div.slayout > div > div.c2 > div:nth-child(1) > div.intro').html();
|
||||
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: `Comicat - ${keyword}`,
|
||||
link: `${baseUrl}/search.php?keyword=${encodeURIComponent(keyword)}`,
|
||||
item: items
|
||||
};
|
||||
};
|
||||
Loading…
Reference in New Issue