Socket
Socket
Sign inDemoInstall

@justalk/pornhub-api

Package Overview
Dependencies
145
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @justalk/pornhub-api

Very complete scrapper for the famous porn website pornhub


Version published
Weekly downloads
28
decreased by-3.45%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Alt text

Last version npm Last version Node version Travis Coverage Status Last version Maintainability Status XO code style

Star the project

Powerful updated scraper for PornHub. Unlike others scrapers, it's working in 2020 October with their new website. It allows you to get any informations out of any page.

Installation

npm install @justalk/pornhub-api

or if you use yarn

yarn add @justalk/pornhub-api --ignore-engines

Short Examples

Scraping the title, pornstars and the download links of a page

const pornhub = require('@justalk/pornhub-api');
const url = 'https://www.pornhub.com/view_video.php?viewkey=ph56fc59c124c0c';
const video = await pornhub.page(url, ['title','pornstars','download_urls']);

Features

  • Scraper: Parse any page of pornhub : search page, model, video page...

  • Download links: Get the download links in all the quality without registering

  • Search pagination: This api can scrap multiple page at the same time

  • Search by different criteria: Possibility to scrap different part of the site and to take advantage of the filter

  • Flexible: The results are always return in a very specific javascrypt type making it easy to integrate to your need.

Scraping of a single video page pornhub

async page(url, options)
nametypedescriptiondefault
urlString[Mandatory] url of the page-
keysArrayList of the keys['title']
Lists of options available for a search (click to show)
name of keyreturn typedescription
titleStringTitle
descriptionStringDescription
viewsNumberNumber total of views
up_votesNumberNumber of up vote
down_votesNumberNumber of down vote
percentNumberPercent of up vote
authorStringName of the uploader
author_subscriberNumberNumber of subscriber of the uploader
pornstarsArrayNames of the pornstars
categoriesArrayList of the names of the categories
tagsArrayList of the names of the tags
productionStringType of production
durationNumberDuration in second
number_of_commentNumberTotal number of comments
thumbnail_urlStringUrl of the thumbnail
upload_dateDateDate of upload
download_urlsObjectList of download link by quality
commentsObjectList of comments with additionnals informations
related_videosObjectList of related video with additionnals informations

Scraping of a search page pornhub

async search(value, keys, options)
nametypedescription
valueStringvalue search in pornhub
keysArray or String if there is only one optionList of the keys
optionsArray[OPTIONNAL] List of the optional options
Lists of options available for a search (click to show)
name of optionsreturn typedescriptionoptionsdefault
pageNumberNumber of page to scraper-1
productionStringType of production targetedhomemade, professional-
min_durationNumberMinimum number of minute of the video searched10, 20, 30-
max_durationNumberMaximum number of minute of the video searched10, 20, 30-
searchStringType of search targetedvideo, pornstars, gifsvideo
promoStringCategory of videopremium, modelhub-
Lists of keys available for a search by video (click to show)
name of keysreturn typedescription
related_searchStringList of the related researches
related_pornstarsStringList of the related pornstars
Lists of keys available for a porn actor search (click to show)
name of keysreturn typedescription
actorStringName of the actor
video_numberNumberNumber of video of the actor
view_numberNumberNumber of view of the actor
rankNumberRank of the actor
Lists of keys available for a gifs search (click to show)
name of keysreturn typedescription
titleStringTitle of the gif
thumbnail_urlStringUrl of the thumbnail
link_mp4StringUrl of the mp4 version
link_webmStringUrl of the webm version

Scraping of a special search page by category

There are two kind of possible way to search on pornhub. The first one is to search by term and the second one is to search by filter. This call is for the search by category and subcategory.

async video(keys, options)
nametypedescriptiondefault
keysArray or String if there is only one option[OPTIONNAL] List of the keysnull
optionsArray[OPTIONNAL] List of the optional optionsnull
Lists of keys available for a special search page by category (click to show)
name of keysreturn typedescription
related_searchStringList of the related videos
related_pornstarsStringList of the related pornstars
Lists of options available for a search (click to show)
name of optionsreturn typedescriptionoptionsdefault
pageNumberNumber of page to scraper-1
productionStringType of production targetedhomemade, professional-
min_durationNumberMinimum number of minute of the video searched10, 20, 30-
max_durationNumberMaximum number of minute of the video searched10, 20, 30-
searchStringType of search targetedvideo, pornstars, gifsvideo
promoStringCategory of videopremium, modelhub-
filterStringFilter of the pageMOST_VIEWED, HOTTEST, TOP_RATED-

Model page pornhub

async model(name, keys)
nametypedescription
nameStringname of the model in pornhub
keysArray or String if there is only one optionList of the keys
typeStringThere is two kind of model : pornstar or model
Lists of keys available for a model page (click to show)
name of keysreturn typedescription
titleStringThe name of the model
descriptionStringThe description of the model
rank_modelStringThe actual rank of the model
rank_week_modelStringThe rank of the model for the week
rank_month_modelStringThe rank of the model for this month
rank_last_month_modelStringThe rank of the model for last month
rank_year_modelStringThe rank of the model for this year
relationship_statusStringThe status of the model (Work only if the model has filled up this field)
interested_inStringThe interest of the model (Work only if the model has filled up this field)
genderStringThe gender of the model (Work only if the model has filled up this field)
birthdayDateThe birthday of the model (Work only if the model has filled up this field)
ageNumberThe age of the model (Work only if the model has filled up this field)
heightStringThe height of the model (Work only if the model has filled up this field)
weightStringThe weight of the model (Work only if the model has filled up this field)
ethnicityStringThe ethnicity of the model (Work only if the model has filled up this field)
video_viewsNumberThe number of video view of the model (Work only if the model has filled up this field)
profile_viewsNumberThe number of profil view of the model (Work only if the model has filled up this field)
videos_watchedNumberThe number of video watched by the model (Work only if the model has filled up this field)
joinedStringThe period passed after the model joined Pornhub

Examples

Scraping the title of a video (click to show)
const pornhub = require('@justalk/pornhub-api');
const video = await pornhub.page(url, ['title']);
{
	"title": "Name of the video"
}
Scraping the title of a video and the description (click to show)
const pornhub = require('@justalk/pornhub-api');
const video = await pornhub.page(url, ['title','description']);
{
	"title": "Name of the video",
	"description": "Description of the video"
}
Scraping the name of the pornstars and the downloads links (click to show)
const pornhub = require('@justalk/pornhub-api');
const video = await pornhub.page(url, ['title','pornstars','download_urls']);
{
	"title": "Title of the video",
	"pornstars": ["Sophie A","Rocco B"],
	"download_urls": {
		"720" : "https://p.com/link1",
		"480" : "https://p.com/link2",
		"360" : "https://p.com/link3"
	}
}
Scraping a search pornhub without options (click to show)
const pornhub = require('@justalk/pornhub-api');
const video = await pornhub.search("Aa",["title","link","premium","hd"]);
[{
	"link": "https://p.com/link1",
	"title": "Title of the video",
	"hd": true,
	"premium": true
},{
	"link": "https://p.com/link2",
	"title": "Title of the video",
	"hd": false,
	"premium": false
}]
Scraping a search pornhub with options (click to show)
const pornhub = require('@justalk/pornhub-api');
const video = await pornhub.search("Aa",["actor","rank"],{production: 'homemade', search: 'pornstars'});
[{
	"actor": "Herica Alue",
	"rank": 8005,
},{
	"actor": "Robert Laach",
	"rank": 60
},{
	"actor": "Aalix Lolo",
	"rank": 6500
}]

How to test/contribute

How to test the API ? (click to show)

For testing, install the node project and run the test command.

node install
npm test

Also, you can use the command under for running the test without the linter

npm run test-no

The tests are not execute on pornhub directly, the calls to pornhub are all mock with nock to save html page of pornhub. It has been done for having page that wont evolve through time. By example, if a comment is added on the real link, the tests will still be ok.

How to contribute ? (click to show)

Any contribution is welcomed !

If you find an issue or just want to add your stone to the castle :

  1. Open an issue
  2. Fork the repository
  3. Create a new branch
  4. Pull Request your change
  5. Wait until I check your code
  6. Merge and add your name on this page forever !

Note

Why does it not work in my country ? (click to show) If pornhub is blocked in your country, the API will obviously not work. You will need a proxy.
Why does it not work at all sometimes ? (click to show) Pornuhub has a scraper protection, if you scrap the website violently (let say hundreds pages in 10 seconds), your ip will be flag as a bot for few minute. Please be gentle with pornhub's server !

License

MIT - Copyright © JUSTAL Kevin

Keywords

FAQs

Last updated on 25 Feb 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc