feat: add hentai cosplay (#4936)

This commit is contained in:
hoilc
2020-06-07 23:42:56 +08:00
committed by GitHub
parent aa520f6475
commit c39cf4e729
5 changed files with 64 additions and 0 deletions

View File

@@ -56,6 +56,12 @@ pageClass: routes
<Route author="hoilc" example="/google/album/msFFnAzKmQmWj76EA" path="/google/album/:id" :paramsDesc="['影集 ID, 可在 URL 中找到, 例如, 分享链接为`https://photos.app.goo.gl/msFFnAzKmQmWj76EA`, 则 ID 为`msFFnAzKmQmWj76EA`']" radar="1" />
## Hentai Cosplay
### 最新图片
<Route author="hoilc" example="/hentai-cosplays/tag/swimsuit" path="/hentai-cosplays/:type?/:name?" :paramsDesc="['搜索类型, `tag`为标签, `keyword`为关键字, 默认留空为全部','搜索内容, 可在 URL 中找到,默认留空为全部']" />
## Konachan Anime Wallpapers
::: tip 提示
@@ -95,6 +101,12 @@ pageClass: routes
<Route author="MegrezZhu hoilc" example="/nhentai/search/language%3Ajapanese+-scat+-yaoi+-guro+-%22mosaic+censorship%22" path="/nhentai/search/:keyword/:mode?" :paramsDesc="['用于搜索的关键词。可在原网站搜索后复制 q= 后面的内容,也可直接输入。用法详见[官网](https://nhentai.net/info/)', '模式,`simple`为仅封面,`detail`会包括本子每一页,但对服务器负载大,`torrent`会包括磁力链接,需要登录,参见[部分 RSS 模块配置](/install/#bu-fen-rss-mo-kuai-pei-zhi)。默认为`simple`']" anticrawler="1" supportBT="1" />
## Porn Image XXX
### 最新图片
<Route author="hoilc" example="/porn-images-xxx/tag/jk" path="/porn-images-xxx/:type?/:name?" :paramsDesc="['搜索类型, `tag`为标签, `keyword`为关键字, 默认留空为全部','搜索内容, 可在 URL 中找到,默认留空为全部']" />
## Tits Guru
### Home

View File

@@ -2814,6 +2814,10 @@ router.get('/gov/caict/bps', require('./routes/gov/caict/bps'));
router.get('/gov/caict/qwsj', require('./routes/gov/caict/qwsj'));
router.get('/gov/caict/caictgd', require('./routes/gov/caict/caictgd'));
// hentai-cosplays
router.get('/hentai-cosplays/:type?/:name?', require('./routes/hentai-cosplays/hentai-cosplays'));
router.get('/porn-images-xxx/:type?/:name?', require('./routes/hentai-cosplays/porn-images-xxx'));
// dcinside
router.get('/dcinside/board/:id', require('./routes/dcinside/board'));

View File

@@ -0,0 +1,11 @@
const { processFeed } = require('./utils');
module.exports = async (ctx) => {
const url = ctx.params.type ? `https://ja.hentai-cosplays.com/search/${ctx.params.type}/${encodeURIComponent(ctx.params.name)}/` : 'https://ja.hentai-cosplays.com/search/';
const items = await processFeed(url);
ctx.state.data = {
title: `${ctx.params.name || '新着コスプレ一覧'} - エロコスプレ`,
link: url,
item: items,
};
};

View File

@@ -0,0 +1,11 @@
const { processFeed } = require('./utils');
module.exports = async (ctx) => {
const url = ctx.params.type ? `https://ja.porn-images-xxx.com/search/${ctx.params.type}/${encodeURIComponent(ctx.params.name)}/` : 'https://ja.porn-images-xxx.com/search/';
const items = await processFeed(url);
ctx.state.data = {
title: `${ctx.params.name || '新着画像一覧'} - エロ画像`,
link: url,
item: items,
};
};

View File

@@ -0,0 +1,26 @@
const cheerio = require('cheerio');
const got = require('hooman');
exports.processFeed = async function processFeed(link) {
const response = await got.get(link);
const $ = cheerio.load(response.body);
const list = $('ul#image-list li');
return (
list &&
list
.map((index, item) => {
item = $(item);
return {
title: item.find('.image-list-item-title').text(),
link: item.find('.image-list-item-title > a').attr('href'),
description: item
.find('.image-list-item-image')
.html()
.replace(/\/p=\d+x\d+/, ''),
pubDate: new Date(item.find('.image-list-item-regist-date').text()),
};
})
.get()
);
};