feat: add pornhub category & search (#5571)

Co-authored-by: Henry Wang <hi@henry.wang>
This commit is contained in:
Ethan Shen
2020-09-06 03:49:21 +08:00
committed by GitHub
parent dbb3cd7902
commit 9612f4fce0
5 changed files with 63 additions and 1 deletions

View File

@@ -68,9 +68,17 @@ Official RSS: https://eztv.io/ezrss.xml
## PornHub
### Category
<RouteEn author="nczitzk" example="/pornhub/category/popular-with-women" path="/pornhub/category/:caty" :paramsDesc="['categorysee [categories](https://cn.pornhub.com/webmasters/categories)']"/>
### Keyword Search
<RouteEn author="nczitzk" example="/pornhub/search/stepsister" path="/pornhub/search/:keyword" :paramsDesc="['keyword']"/>
### Video List
<Route author="I2IMk" example="/pornhub/category_url/video%3Fc%3D15%26o%3Dmv%26t%3Dw%26cc%3Djp" path="/pornhub/category_url/:url?" :paramsDesc="['relative path after `pornhub.com/`, need to be URL encoded']"/>
<RouteEn author="I2IMk" example="/pornhub/category_url/video%3Fc%3D15%26o%3Dmv%26t%3Dw%26cc%3Djp" path="/pornhub/category_url/:url?" :paramsDesc="['relative path after `pornhub.com/`, need to be URL encoded']"/>
## Sankaku Complex

View File

@@ -271,6 +271,14 @@ pageClass: routes
## PornHub
### 分类
<Route author="nczitzk" example="/pornhub/category/popular-with-women" path="/pornhub/category/:caty" :paramsDesc="['类别,参见 [categories](https://cn.pornhub.com/webmasters/categories)']"/>
### 搜索
<Route author="nczitzk" example="/pornhub/search/stepsister" path="/pornhub/search/:keyword" :paramsDesc="['关键字']"/>
### 视频列表
<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 编码']"/>

View File

@@ -303,6 +303,8 @@ router.get('/konachan.com/post/popular_recent/:period', require('./routes/konach
router.get('/konachan.net/post/popular_recent/:period', require('./routes/konachan/post_popular_recent'));
// PornHub
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'));
// yande.re

View File

@@ -0,0 +1,22 @@
const got = require('@/utils/got');
module.exports = async (ctx) => {
const currentUrl = `https://pornhub.com/webmasters/search?category=${ctx.params.caty}`;
const response = await got({
method: 'get',
url: currentUrl,
});
const list = response.data.videos.map((item) => ({
title: item.title,
link: item.url,
description: `<img src="${item.thumb}">`,
pubDate: new Date(item.publish_date).toUTCString(),
}));
ctx.state.data = {
title: `Pornhub - ${ctx.params.caty}`,
link: currentUrl,
item: list,
};
};

View File

@@ -0,0 +1,22 @@
const got = require('@/utils/got');
module.exports = async (ctx) => {
const currentUrl = `https://pornhub.com/webmasters/search?search=${ctx.params.keyword}`;
const response = await got({
method: 'get',
url: currentUrl,
});
const list = response.data.videos.map((item) => ({
title: item.title,
link: item.url,
description: `<img src="${item.thumb}">`,
pubDate: new Date(item.publish_date).toUTCString(),
}));
ctx.state.data = {
title: `Pornhub - ${ctx.params.keyword}`,
link: currentUrl,
item: list,
};
};