feat(route): laimanhua (#14297)
This commit is contained in:
parent
4644ce5755
commit
70b4385bf1
|
|
@ -0,0 +1,41 @@
|
|||
const got = require('@/utils/got');
|
||||
const iconv = require('iconv-lite');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { id } = ctx.params;
|
||||
const baseUrl = `https://www.laimanhua8.com`;
|
||||
const link = `${baseUrl}/kanmanhua/${id}/`;
|
||||
|
||||
const { data: response } = await got(link, {
|
||||
responseType: 'buffer',
|
||||
});
|
||||
let $ = cheerio.load(iconv.decode(response, 'utf-8'));
|
||||
const charset = $('meta[http-equiv="Content-Type"]')
|
||||
.attr('content')
|
||||
?.match(/charset=(.*)/)?.[1];
|
||||
if (charset?.toLowerCase() !== 'utf-8') {
|
||||
$ = cheerio.load(iconv.decode(response, charset ?? 'utf-8'));
|
||||
}
|
||||
|
||||
const items = $('.plist a')
|
||||
.toArray()
|
||||
.map((item, index) => {
|
||||
item = $(item);
|
||||
return {
|
||||
title: item.attr('title'),
|
||||
link: `${baseUrl}${item.attr('href')}`,
|
||||
pubDate: index === 0 ? parseDate($('head meta[property="og:novel:update_time"]').attr('content')) : null,
|
||||
author: $('head meta[property="og:novel:author"]').attr('content'),
|
||||
};
|
||||
});
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${$('head meta[property="og:novel:book_name"]').attr('content')} - 来漫画`,
|
||||
description: $('.introduction').text(),
|
||||
image: $('head meta[property="og:image"]').attr('content'),
|
||||
link,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
'/:id': ['TonyRL'],
|
||||
};
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
module.exports = {
|
||||
'laimanhua8.com': {
|
||||
_name: '来漫画',
|
||||
www: [
|
||||
{
|
||||
title: '漫画列表',
|
||||
docs: 'https://docs.rsshub.app/routes/anime#lai-man-hua',
|
||||
source: '/kanmanhua/:id',
|
||||
target: '/laimanhua/:id',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = (router) => {
|
||||
router.get('/:id', require('./index'));
|
||||
};
|
||||
|
|
@ -694,6 +694,12 @@ You can use some RSS parsing libraries (like `feedpraser` in `Python`) to receiv
|
|||
|
||||
<Route author="btdwv marvolo666 yan12125" path="/copymanga/comic/:id/:chapterCnt?" example="/copymanga/comic/dianjuren/5" paramsDesc={['漫画ID', '返回章节的数量,默认为 `10`']} radar="1" />
|
||||
|
||||
## 来漫画 {#lai-man-hua}
|
||||
|
||||
### 漫画列表 {#lai-man-hua-man-hua-lie-biao}
|
||||
|
||||
<Route author="TonyRL" example="/laimanhua/tiandikangzhanjiVERSUS" path="/laimanhua/:id" paramsDesc={['漫画 ID,可在 URL 中找到']} radar="1" />
|
||||
|
||||
## 漫画 DB {#man-hua-db}
|
||||
|
||||
### 漫画 DB {#man-hua-db-man-hua-db}
|
||||
|
|
|
|||
Loading…
Reference in New Issue