-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
304 additions
and
200 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
const got = require('@/utils/got'); | ||
const { parseDate } = require('@/utils/parse-date'); | ||
const { defaultDomain, renderDescription } = require('./utils'); | ||
const config = require('@/config').value; | ||
|
||
module.exports = async (ctx) => { | ||
const category = ctx.params.caty; | ||
|
||
const categories = await ctx.cache.tryGet('pornhub:categories', async () => { | ||
const { data } = await got(`${defaultDomain}/webmasters/categories`); | ||
return data.categories; | ||
}); | ||
|
||
const categoryId = isNaN(category) ? categories.find((item) => item.category === category)?.id : category; | ||
const categoryName = isNaN(category) ? category : categories.find((item) => item.id === parseInt(category)).category; | ||
|
||
const response = await ctx.cache.tryGet( | ||
`pornhub:category:${categoryName}`, | ||
async () => { | ||
const { data } = await got(`${defaultDomain}/webmasters/search?category=${categoryName}`); | ||
return data; | ||
}, | ||
config.cache.routeExpire, | ||
false | ||
); | ||
|
||
if (response.code) { | ||
throw Error(response.message); | ||
} | ||
|
||
const list = response.videos.map((item) => ({ | ||
title: item.title, | ||
link: item.url, | ||
description: renderDescription({ thumbs: item.thumbs }), | ||
pubDate: parseDate(item.publish_date), | ||
category: [...new Set([...item.tags.map((t) => t.tag_name), ...item.categories.map((c) => c.category)])], | ||
})); | ||
|
||
ctx.state.data = { | ||
title: `Pornhub - ${categoryName}`, | ||
link: `${defaultDomain}/video?c=${categoryId}`, | ||
item: list, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const got = require('@/utils/got'); | ||
const cheerio = require('cheerio'); | ||
const { isValidHost } = require('@/utils/valid-host'); | ||
const { headers, parseItems } = require('./utils'); | ||
|
||
module.exports = async (ctx) => { | ||
const { language = 'www', url = 'video' } = ctx.params; | ||
const link = `https://${language}.pornhub.com/${url}`; | ||
if (!isValidHost(language)) { | ||
throw Error('Invalid language'); | ||
} | ||
|
||
const { data: response } = await got(link, { headers }); | ||
const $ = cheerio.load(response); | ||
const items = $('#videoCategory .videoBox') | ||
.toArray() | ||
.map((e) => parseItems($(e))); | ||
|
||
ctx.state.data = { | ||
title: $('title').first().text(), | ||
link, | ||
language: $('html').attr('lang'), | ||
item: items, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module.exports = { | ||
'/category/:caty': ['nczitzk'], | ||
'/search/:keyword': ['nczitzk'], | ||
'/:language?/category_url/:url?': ['I2IMk', 'queensferryme'], | ||
'/:language?/model/:username/:sort?': ['I2IMk', 'queensferryme'], | ||
'/:language?/pornstar/:username/:sort?': ['I2IMk', 'queensferryme'], | ||
'/:language?/users/:username': ['I2IMk', 'queensferryme'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const got = require('@/utils/got'); | ||
const cheerio = require('cheerio'); | ||
const { isValidHost } = require('@/utils/valid-host'); | ||
const { headers, parseItems } = require('./utils'); | ||
|
||
module.exports = async (ctx) => { | ||
const { language = 'www', username, sort = '' } = ctx.params; | ||
const link = `https://${language}.pornhub.com/model/${username}/videos${sort ? `?o=${sort}` : ''}`; | ||
if (!isValidHost(language)) { | ||
throw Error('Invalid language'); | ||
} | ||
|
||
const { data: response } = await got(link, { headers }); | ||
const $ = cheerio.load(response); | ||
const items = $('#mostRecentVideosSection .videoBox') | ||
.toArray() | ||
.map((e) => parseItems($(e))); | ||
|
||
ctx.state.data = { | ||
title: $('title').first().text(), | ||
description: $('section.aboutMeSection').text().trim(), | ||
link, | ||
image: $('#coverPictureDefault').attr('src'), | ||
logo: $('#getAvatar').attr('src'), | ||
icon: $('#getAvatar').attr('src'), | ||
language: $('html').attr('lang'), | ||
item: items, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const got = require('@/utils/got'); | ||
const cheerio = require('cheerio'); | ||
const { isValidHost } = require('@/utils/valid-host'); | ||
const { headers, parseItems } = require('./utils'); | ||
|
||
module.exports = async (ctx) => { | ||
const { language = 'www', username, sort = 'mr' } = ctx.params; | ||
const link = `https://${language}.pornhub.com/pornstar/${username}/videos?o=${sort}`; | ||
if (!isValidHost(language)) { | ||
throw Error('Invalid language'); | ||
} | ||
|
||
const { data: response } = await got(link, { headers }); | ||
const $ = cheerio.load(response); | ||
const items = $('#mostRecentVideosSection .videoBox') | ||
.toArray() | ||
.map((e) => parseItems($(e))); | ||
|
||
ctx.state.data = { | ||
title: $('title').first().text(), | ||
description: $('section.aboutMeSection').text().trim(), | ||
link, | ||
image: $('#coverPictureDefault').attr('src'), | ||
logo: $('#getAvatar').attr('src'), | ||
icon: $('#getAvatar').attr('src'), | ||
language: $('html').attr('lang'), | ||
item: items, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
module.exports = { | ||
'pornhub.com': { | ||
_name: 'PornHub', | ||
'.': [ | ||
{ | ||
title: 'Category', | ||
docs: 'https://docs.rsshub.app/routes/multimedia#pornhub', | ||
source: ['/categories/:caty', '/video'], | ||
target: (params, url) => { | ||
if (params.caty) { | ||
return `/pornhub/category/${params.caty}`; | ||
} | ||
return `/pornhub/category/${new URL(url).searchParams.get('c')}`; | ||
}, | ||
}, | ||
{ | ||
title: 'Keyword Search', | ||
docs: 'https://docs.rsshub.app/routes/multimedia#pornhub', | ||
source: ['/video/search'], | ||
target: (_, url) => `/pornhub/category/${new URL(url).searchParams.get('search')}`, | ||
}, | ||
{ | ||
title: 'Users', | ||
docs: 'https://docs.rsshub.app/routes/multimedia#pornhub', | ||
source: ['/users/:username/*'], | ||
target: '/pornhub/users/:username', | ||
}, | ||
{ | ||
title: 'Verified amateur / Model', | ||
docs: 'https://docs.rsshub.app/routes/multimedia#pornhub', | ||
source: ['/model/:username/*'], | ||
target: '/pornhub/model/:username', | ||
}, | ||
{ | ||
title: 'Verified model / Pornstar', | ||
docs: 'https://docs.rsshub.app/routes/multimedia#pornhub', | ||
source: ['/pornstar/:username/*'], | ||
target: '/pornhub/pornstar/:username', | ||
}, | ||
{ | ||
title: 'Video List', | ||
docs: 'https://docs.rsshub.app/routes/multimedia#pornhub', | ||
}, | ||
], | ||
}, | ||
}; |
Oops, something went wrong.