Skip to content


Folders and files

Last commit message
Last commit date

Latest commit



60 Commits

Repository files navigation

PornHub Unofficial API

Unofficial API for in Python

Pull requests are welcome!!!

I find it quite difficult to make time for an active development on this project, so I will be more than happy to merge your pull requests. Thank you all for supporting this project!


pip3 install pornhubapi

How to use

Create client

import pornhub
client = pornhub.PornHub()

Create client with proxy

import pornhub
# With proxy, given a Proxy IP and Port. For the countries with restricted access like Turkey, etc.
client = pornhub.PornHub("", 3128)

Grab stars

The request can be sorted by: view, trend, subs, alpha, videos, random

for star in client.getStars(10, sort_by="view"):

Create client with search keywords

keywords = ["word1", "word2"]
client = pornhub.PornHub(keywords)

# if using a proxy
client = pornhub.PornHub(keywords, "", 3128)
# or
client = pornhub.PornHub(ProxyIP="", ProxyPort=3128, keywords=["word1", "word2"])

for video in client.getVideos(10, page=2):

Sort Video by parameter

When keywords are set: view, rate, long, recent

keywords = ["word1", "word2"]
client = pornhub.PornHub(keywords)

for video in client.getVideos(10, page=2, sort_by="long"):

When keywords are not set: view, rate, long, new, hot

client = pornhub.PornHub()

for video in client.getVideos(10, page=2, sort_by="hot"):

Take full information about all videos

Parameter full_data allows you to get complete information about the video, but its much more slower due to every page needs to be opened

keywords = ["word1", "word2"]
client = pornhub.PornHub(keywords)

for video in client.getVideos(10, page=2, full_data=True):

Get more information about the single video

Method getVideo(url, viewkey) gives more detail information about a single video

client = pornhub.PornHub()

# You can input the full video url, like that
video = client.getVideo("")
# Or that
video = client.getVideo(url="")
# Or input only viewkey, like that
video = client.getVideo(viewkey="SOMEKEY")


The method return a dictionary with keywords:

  1. title (type: string) - Video title
  2. views (type: string) - Rounded number of views, for example "2M"
  3. accurate_views (type: integer) - Full number of views, for example "123456789". When video don't have many views views=accurate_views
  4. rating (type: integer) - Video rating in percent
  5. duration (type: string) - Video duration in format "hh:mm:ss"
  6. loaded (type: string) - When the video was uploaded, for example "2 months ago"
  7. upload_date (type: string) - Video upload date in format "yyyy-mm-dd"
  8. likes (type: string) - Similar like views
  9. accurate_likes (type: integer) - Similar like accurate_views
  10. dislikes (type: string) - Similar like views
  11. accurate_dislikes (type: integer) - Similar like accurate_views
  12. favorite (type: string) - How many times added to favorites, rounded. For example "2K"
  13. author (type: string) - Video author (channel)
  14. pornstars (type: list) - Video stars
  15. categories (type: list) - Video categories
  16. tags (type: list) - Video tags
  17. production (type: string) - Video production (Professional or Homemade)
  18. url (type: string) - URL to Video
  19. img_url (type: string) - URL to Preview Image of Video
  20. embed_url (type: string) - URL to Video Player

If the video is not available in your country, in title will "Video not available in your country", in others keys will None



Ibrahim Ipek


Елизаров Роман Русланович



MIT license