feat: 新增【Prestige 蚊香社】系列作品订阅 (#6016)

This commit is contained in:
Trojan Yao 2020-11-01 23:16:37 +08:00 committed by GitHub
parent 991aeab1bf
commit 7970e588f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 54 additions and 0 deletions

View File

@ -411,6 +411,16 @@ pageClass: routes
<Route author="I2IMk" example="/pornhub/category_url/video%3Fc%3D15%26o%3Dmv%26t%3Dw%26cc%3Djp" path="/pornhub/category_url/:url?" :paramsDesc="['相对路径, `pornhub.com/` 后的部分, 需手动 URL 编码']"/>
## Prestige 蚊香社
### 系列作品
<Route author="minimalistrojan" example="/prestige-av/series/847" path="/prestige-av/series/:mid/:sort?" :paramsDesc="['系列编号', '排序方式,缺省为 near最新']"/>
| 人气 | 最新 | 发售日期 | 标题顺序 | 价格升序 | 价格降序 |
| ------- | ---- | -------- | -------- | -------- | -------- |
| popular | near | date | title | low | high |
## rs05 人生 05 电影
### rs05 电影列表

View File

@ -311,6 +311,9 @@ router.get('/pornhub/users/:username', require('./routes/pornhub/users'));
router.get('/pornhub/model/:username/:sort?', require('./routes/pornhub/model'));
router.get('/pornhub/pornstar/:username/:sort?', require('./routes/pornhub/pornstar'));
// Prestige
router.get('/prestige-av/series/:mid/:sort?', require('./routes/prestige-av/series'));
// yande.re
router.get('/yande.re/post/popular_recent', require('./routes/yande.re/post_popular_recent'));
router.get('/yande.re/post/popular_recent/:period', require('./routes/yande.re/post_popular_recent'));

View File

@ -0,0 +1,41 @@
const cheerio = require('cheerio');
const puppeteer = require('puppeteer');
module.exports = async (ctx) => {
const browser = await puppeteer.launch({
args: ['--disable-dev-shm-usage'],
});
const id = ctx.params.mid;
const sort = ctx.params.sort || 'near';
const page = await browser.newPage();
const link = `https://www.prestige-av.com/goods/goods_list.php?mode=series&mid=${id}&sort=${sort}`;
await page.goto(link);
await page.waitForSelector('.button_r18_prestige');
await page.click('#AC');
await page.waitForSelector('#body_goods');
const html = await page.evaluate((window) => window.document.body.innerHTML);
const $ = cheerio.load(html);
const list = $('div#body_goods li');
ctx.state.data = {
title: `【Prestige】${$('div[class=search_title_layout_01]').children('h1').first().text().replace('シリーズ ▶ ', '').replace(/\s*/g, '')}`,
link: `https://www.prestige-av.com/goods/goods_list.php?mode=series&mid=${id}&sort=${sort}`,
item:
list &&
list
.map((index, item) => {
item = $(item);
return {
title: item.find('span.title').text().replace(/\s*/g, ''),
description: item.find('div.spec_layout').children('p').first().text().replace(/\s*/g, '') + '<br/>' + `<img src="https://www.prestige-av.com/${item.find('img').attr('src').replace('pf_t1', 'pb_e')}"/>`,
link: item.find('a').attr('href'),
};
})
.get(),
};
browser.close();
};