From 269e178a0b1350f5c62fc48ee43a7498c5cb5fd6 Mon Sep 17 00:00:00 2001 From: I2IMk <66695371+I2IMk@users.noreply.github.com> Date: Tue, 8 Sep 2020 19:39:59 +0800 Subject: [PATCH] feat: add pornhub model/pornstar (#5629) --- docs/en/multimedia.md | 16 ++++++++++++++++ docs/multimedia.md | 14 ++++++++++++++ lib/router.js | 2 ++ lib/routes/pornhub/category_url.js | 2 +- lib/routes/pornhub/model.js | 30 ++++++++++++++++++++++++++++++ lib/routes/pornhub/pornstar.js | 30 ++++++++++++++++++++++++++++++ 6 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 lib/routes/pornhub/model.js create mode 100644 lib/routes/pornhub/pornstar.js diff --git a/docs/en/multimedia.md b/docs/en/multimedia.md index 360a10858c..c2304c0132 100644 --- a/docs/en/multimedia.md +++ b/docs/en/multimedia.md @@ -76,6 +76,22 @@ Official RSS: https://eztv.io/ezrss.xml +### Verified amateur / Model + + + +### Verified model / Pornstar + + + +**`sort`** + +| mr | mv | tr | lg | cm | +| ----------- | ----------- | --------- | ------- | ------ | +| Most Recent | Most Viewed | Top Rated | Longest | Newest | + + + ### Video List diff --git a/docs/multimedia.md b/docs/multimedia.md index 38f381c171..9bb9cbf047 100644 --- a/docs/multimedia.md +++ b/docs/multimedia.md @@ -279,6 +279,20 @@ pageClass: routes +### 素人(Verified amateur /model) + + + +### 色情明星(Verified model /pornstar) + + + +**排序方式 `sort`** + +| mr | mv | tr | lg | cm | +| -------------------- | ---------------------- | ------------------ | ------------ | ----------- | +| Most Recent 最新精选 | Most Viewed 最多次观看 | Top Rated 评价最好 | Longest 最长 | Newest 最新 | + ### 视频列表 diff --git a/lib/router.js b/lib/router.js index 267a73dccd..0e96e4c2d0 100644 --- a/lib/router.js +++ b/lib/router.js @@ -306,6 +306,8 @@ router.get('/konachan.net/post/popular_recent/:period', require('./routes/konach router.get('/pornhub/category/:caty', require('./routes/pornhub/category')); router.get('/pornhub/search/:keyword', require('./routes/pornhub/search')); router.get('/pornhub/category_url/:url?', require('./routes/pornhub/category_url')); +router.get('/pornhub/model/:username/:sort?', require('./routes/pornhub/model')); +router.get('/pornhub/pornstar/:username/:sort?', require('./routes/pornhub/pornstar')); // yande.re router.get('/yande.re/post/popular_recent', require('./routes/yande.re/post_popular_recent')); diff --git a/lib/routes/pornhub/category_url.js b/lib/routes/pornhub/category_url.js index d3640d8437..0e5e3f8be6 100644 --- a/lib/routes/pornhub/category_url.js +++ b/lib/routes/pornhub/category_url.js @@ -21,7 +21,7 @@ module.exports = async (ctx) => { return { title: e.find('span.title a').text(), link: `https://www.pornhub.com` + e.find('span.title a').attr('href'), - description: ``, + description: ``, }; }) .get(), diff --git a/lib/routes/pornhub/model.js b/lib/routes/pornhub/model.js new file mode 100644 index 0000000000..6df7b1df8b --- /dev/null +++ b/lib/routes/pornhub/model.js @@ -0,0 +1,30 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const username = ctx.params.username; + const sort = ctx.params.sort ? ctx.params.sort : 'mr'; + const link = `https://www.pornhub.com/model/${username}/videos?o=${sort}`; + + const response = await got.get(link); + const $ = cheerio.load(response.data); + const list = $('#mostRecentVideosSection .videoBox'); + + ctx.state.data = { + title: $('title').first().text(), + link: link, + item: + list && + list + .map((_, e) => { + e = $(e); + + return { + title: e.find('span.title a').text(), + link: `https://www.pornhub.com` + e.find('span.title a').attr('href'), + description: ``, + }; + }) + .get(), + }; +}; diff --git a/lib/routes/pornhub/pornstar.js b/lib/routes/pornhub/pornstar.js new file mode 100644 index 0000000000..543e859f79 --- /dev/null +++ b/lib/routes/pornhub/pornstar.js @@ -0,0 +1,30 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const username = ctx.params.username; + const sort = ctx.params.sort ? ctx.params.sort : 'mr'; + const link = `https://www.pornhub.com/pornstar/${username}/videos?o=${sort}`; + + const response = await got.get(link); + const $ = cheerio.load(response.data); + const list = $('#mostRecentVideosSection .videoBox'); + + ctx.state.data = { + title: $('title').first().text(), + link: link, + item: + list && + list + .map((_, e) => { + e = $(e); + + return { + title: e.find('span.title a').text(), + link: `https://www.pornhub.com` + e.find('span.title a').attr('href'), + description: ``, + }; + }) + .get(), + }; +};