feat(route): wnacg full comic (#11625)
This commit is contained in:
parent
e4053665d9
commit
c990508717
|
|
@ -739,11 +739,15 @@ Sources
|
|||
|
||||
### 最新
|
||||
|
||||
<Route author="KenMizz" example="/ssmh" path="/ssmh/" />
|
||||
<Route author="KenMizz" example="/wnacg" path="/wnacg" radar="1"/>
|
||||
|
||||
### 分类更新
|
||||
|
||||
<Route author="Gandum2077" example="/ssmh/category/6" path="/ssmh/category/:cid" :paramsDesc="['分类的id,即对应 URL 中的数字']" />
|
||||
<Route author="Gandum2077" example="/wnacg/category/6" path="/wnacg/category/:cid" :paramsDesc="['分类的 id,即对应 URL 中的数字']" radar="1"/>
|
||||
|
||||
### 標籤更新
|
||||
|
||||
<Route author="Gandum2077" example="/wnacg/tag/漢化" path="/wnacg/tag/:tag" :paramsDesc="['標籤,即 URL 中的 `tag-`後的文字']" radar="1"/>
|
||||
|
||||
## 鼠绘漫画
|
||||
|
||||
|
|
|
|||
|
|
@ -2603,8 +2603,8 @@ router.get('/weexcn/news/:typeid', lazyloadRouteHandler('./routes/weexcn/index')
|
|||
// router.get('/eastmoney/ttjj/user/:uid', lazyloadRouteHandler('./routes/eastmoney/ttjj/user'));
|
||||
|
||||
// 紳士漫畫
|
||||
router.get('/ssmh', lazyloadRouteHandler('./routes/ssmh'));
|
||||
router.get('/ssmh/category/:cid', lazyloadRouteHandler('./routes/ssmh/category'));
|
||||
// router.get('/ssmh', lazyloadRouteHandler('./routes/ssmh'));
|
||||
// router.get('/ssmh/category/:cid', lazyloadRouteHandler('./routes/ssmh/category'));
|
||||
|
||||
// 华南师范大学研究生学院
|
||||
router.get('/scnuyjs', lazyloadRouteHandler('./routes/universities/scnu/scnuyjs'));
|
||||
|
|
|
|||
|
|
@ -1,50 +0,0 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
const categories = {
|
||||
1: '同人誌 漢化',
|
||||
2: '同人誌 CG畫集',
|
||||
3: '同人誌 Cosplay',
|
||||
5: '同人誌',
|
||||
6: '單行本',
|
||||
7: '雜誌&短篇',
|
||||
9: '單行本 漢化',
|
||||
10: '雜誌&短篇 漢化',
|
||||
12: '同人誌 日語',
|
||||
13: '單行本 日語',
|
||||
14: '雜誌&短篇 日語',
|
||||
};
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const cid = ctx.params.cid;
|
||||
if (!cid || !Object.keys(categories).includes(cid)) {
|
||||
ctx.state.data = {
|
||||
title: '此分类不存在',
|
||||
};
|
||||
return;
|
||||
}
|
||||
const url = `https://www.wnacg.com/albums-index-cate-${cid}.html`;
|
||||
const response = await got.get(url);
|
||||
|
||||
const data = response.data;
|
||||
|
||||
const $ = cheerio.load(data);
|
||||
const list = $('.pic_box');
|
||||
|
||||
ctx.state.data = {
|
||||
title: '紳士漫畫 - ' + categories[cid],
|
||||
link: url,
|
||||
item: list
|
||||
.map((index, item) => {
|
||||
item = $(item);
|
||||
const thumbnail_url = 'https:' + (item.find('a > img').attr('src') ? item.find('a > img').attr('src') : item.find('a > img').attr('data-original'));
|
||||
const link_url = 'https://wnacg.org' + item.find('a').attr('href');
|
||||
return {
|
||||
title: item.find('a').attr('title'),
|
||||
description: `<img src=${thumbnail_url} referrerpolicy="no-referrer">`,
|
||||
link: link_url,
|
||||
};
|
||||
})
|
||||
.get(),
|
||||
};
|
||||
};
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: 'https://wnacg.org/albums.html',
|
||||
});
|
||||
|
||||
const data = response.data;
|
||||
|
||||
const $ = cheerio.load(data);
|
||||
const list = $('.pic_box');
|
||||
let thumbnail_url;
|
||||
let link_url;
|
||||
ctx.state.data = {
|
||||
title: '紳士漫畫',
|
||||
link: 'https://wnacg.org/albums.html',
|
||||
item: list
|
||||
.map((index, item) => {
|
||||
item = $(item);
|
||||
thumbnail_url = `https:${item.find('a > img').attr('src') ?? item.find('a > img').attr('data-original')}`;
|
||||
link_url = `https://wnacg.org${item.find('a').attr('href')}`;
|
||||
return {
|
||||
title: item.find('a').attr('title'),
|
||||
description: `<img src=${thumbnail_url} referrerpolicy="no-referrer">`,
|
||||
link: link_url,
|
||||
};
|
||||
})
|
||||
.get(),
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,110 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const { art } = require('@/utils/render');
|
||||
const path = require('path');
|
||||
|
||||
const categories = {
|
||||
1: '同人誌 漢化',
|
||||
2: '同人誌 CG畫集',
|
||||
3: '同人誌 Cosplay',
|
||||
5: '同人誌',
|
||||
6: '單行本',
|
||||
7: '雜誌&短篇',
|
||||
9: '單行本 漢化',
|
||||
10: '雜誌&短篇 漢化',
|
||||
12: '同人誌 日語',
|
||||
13: '單行本 日語',
|
||||
14: '雜誌&短篇 日語',
|
||||
16: '同人誌 English',
|
||||
17: '單行本 English',
|
||||
19: '韓漫',
|
||||
20: '韓漫 漢化',
|
||||
21: '韓漫 生肉',
|
||||
};
|
||||
|
||||
const baseUrl = 'https://wnacg.org';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { cid, tag } = ctx.params;
|
||||
if (cid && !Object.keys(categories).includes(cid)) {
|
||||
throw Error('此分类不存在');
|
||||
}
|
||||
|
||||
const url = `${baseUrl}/albums${cid ? `-index-cate-${cid}` : ''}${tag ? `-index-tag-${tag}` : ''}.html`;
|
||||
const { data } = await got(url);
|
||||
const $ = cheerio.load(data);
|
||||
|
||||
const list = $('.gallary_item')
|
||||
.toArray()
|
||||
.map((item) => {
|
||||
item = $(item);
|
||||
const href = item.find('a').attr('href');
|
||||
const aid = href.match(/^\/photos-index-aid-(\d+)\.html$/)[1];
|
||||
return {
|
||||
title: item.find('a').attr('title'),
|
||||
link: `${baseUrl}${href}`,
|
||||
pubDate: parseDate(
|
||||
item
|
||||
.find('.info_col')
|
||||
.text()
|
||||
.replace(/\d+張照片,\n創建於/, ''),
|
||||
'YYYY-MM-DD'
|
||||
),
|
||||
aid,
|
||||
};
|
||||
});
|
||||
|
||||
const items = await Promise.all(
|
||||
list.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const { data: descRes } = await got(item.link, {
|
||||
headers: {
|
||||
referer: encodeURI(url),
|
||||
},
|
||||
});
|
||||
let $ = cheerio.load(descRes);
|
||||
const author = $('.uwuinfo p').first().text();
|
||||
const category = $('.tagshow')
|
||||
.toArray()
|
||||
.map((item) => $(item).text());
|
||||
$('.addtags').remove();
|
||||
const description = $('.uwconn').html();
|
||||
|
||||
const { data } = await got(`${baseUrl}/photos-gallery-aid-${item.aid}.html`, {
|
||||
headers: {
|
||||
referer: `${baseUrl}/photos-slide-aid-${item.aid}.html`,
|
||||
},
|
||||
});
|
||||
$ = cheerio.load(data);
|
||||
|
||||
const imgListMatch = $('script')
|
||||
.text()
|
||||
.match(/var imglist = (\[.*\]);"\);/)[1];
|
||||
|
||||
const imgList = JSON.parse(
|
||||
imgListMatch
|
||||
.replace(/url:/g, '"url":')
|
||||
.replace(/caption:/g, '"caption":')
|
||||
.replace(/fast_img_host\+\\/g, '')
|
||||
.replace(/\\/g, '')
|
||||
);
|
||||
|
||||
item.author = author;
|
||||
item.category = category;
|
||||
item.description = art(path.join(__dirname, 'templates/manga.art'), {
|
||||
description,
|
||||
imgList,
|
||||
});
|
||||
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: $('head title').text(),
|
||||
link: url,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
module.exports = {
|
||||
'/': ['KenMizz'],
|
||||
'/category/:cid': ['Gandum2077'],
|
||||
'/tag/:tag': ['Gandum2077'],
|
||||
};
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
module.exports = {
|
||||
'wnacg.org': {
|
||||
_name: '紳士漫畫',
|
||||
'.': [
|
||||
{
|
||||
title: '最新',
|
||||
docs: 'https://docs.rsshub.app/anime.html#shen-shi-man-hua',
|
||||
source: ['/albums.html', '/'],
|
||||
target: '/wnacg',
|
||||
},
|
||||
{
|
||||
title: '分类更新',
|
||||
docs: 'https://docs.rsshub.app/anime.html#shen-shi-man-hua',
|
||||
source: ['/*'],
|
||||
target: (_, url) => `/wnacg/category/${new URL(url).pathname.match(/albums-index-cate-(\d+)\.html$/)[1]}`,
|
||||
},
|
||||
{
|
||||
title: '標籤更新',
|
||||
docs: 'https://docs.rsshub.app/anime.html#shen-shi-man-hua',
|
||||
source: ['/*'],
|
||||
target: (_, url) => `/wnacg/tag/${new URL(url).pathname.match(/albums-index-tag-(.+?)\.html$/)[1]}`,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
module.exports = (router) => {
|
||||
router.get('/', require('./index'));
|
||||
router.get('/category/:cid', require('./index'));
|
||||
router.get('/tag/:tag', require('./index'));
|
||||
};
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
{{ if description }}
|
||||
{{@ description }}
|
||||
{{ /if }}
|
||||
<br>
|
||||
{{ if imgList }}
|
||||
{{ each imgList img }}
|
||||
<img src="https:{{ img.url }}" alt="{{ img.caption }}">
|
||||
{{ /each }}
|
||||
{{ /if }}
|
||||
Loading…
Reference in New Issue