{"id":13826868,"url":"https://github.com/sskender/pornhub-api","last_synced_at":"2025-04-12T21:28:21.816Z","repository":{"id":41818417,"uuid":"77469412","full_name":"sskender/pornhub-api","owner":"sskender","description":"Unofficial API for PornHub.com in Python","archived":false,"fork":false,"pushed_at":"2023-12-30T00:34:32.000Z","size":40,"stargazers_count":411,"open_issues_count":7,"forks_count":90,"subscribers_count":31,"default_branch":"master","last_synced_at":"2025-04-04T01:07:54.698Z","etag":null,"topics":["api","beautifulsoup","beautifulsoup4","parser","pip","pip3","porn","porn-download","porn-website","pornhub","pornhub-api","pornhub-downloader","pornhubapi","porno","pornography","proxy","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sskender.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-12-27T16:42:52.000Z","updated_at":"2025-04-03T13:01:31.000Z","dependencies_parsed_at":"2023-12-30T01:38:52.969Z","dependency_job_id":"d820c419-5a09-4322-b21c-cfdce6b3b543","html_url":"https://github.com/sskender/pornhub-api","commit_stats":{"total_commits":49,"total_committers":7,"mean_commits":7.0,"dds":0.4897959183673469,"last_synced_commit":"34049b10b67f85e78d6fc3aab414a89a309ef10e"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sskender%2Fpornhub-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sskender%2Fpornhub-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sskender%2Fpornhub-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sskender%2Fpornhub-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sskender","download_url":"https://codeload.github.com/sskender/pornhub-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248633936,"owners_count":21136944,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","beautifulsoup","beautifulsoup4","parser","pip","pip3","porn","porn-download","porn-website","pornhub","pornhub-api","pornhub-downloader","pornhubapi","porno","pornography","proxy","python"],"created_at":"2024-08-04T09:01:45.691Z","updated_at":"2025-04-12T21:28:21.796Z","avatar_url":"https://github.com/sskender.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# PornHub Unofficial API\n\nUnofficial API for pornhub.com in Python\n\n### *Pull requests are welcome!!!*\n\nI 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!\n\n## Install\n\n```bash\npip3 install pornhubapi\n```\n\n## How to use\n\n#### Create client\n\n```python\nimport pornhub\nclient = pornhub.PornHub()\n```\n\n#### Create client with proxy\n\n```python\nimport pornhub\n# With proxy, given a Proxy IP and Port. For the countries with restricted access like Turkey, etc.\nclient = pornhub.PornHub(\"5.135.164.72\", 3128)\n```\n\n#### Grab stars\n\nThe request can be sorted by: `view`, `trend`, `subs`, `alpha`, `videos`, `random`\n\n```python\nfor star in client.getStars(10, sort_by=\"view\"):\n    print(star)\n    print(star[\"name\"])\n```\n\n#### Create client with search keywords\n\n```python\nkeywords = [\"word1\", \"word2\"]\nclient = pornhub.PornHub(keywords)\n\n# if using a proxy\nclient = pornhub.PornHub(keywords, \"5.135.164.72\", 3128)\n# or\nclient = pornhub.PornHub(ProxyIP=\"5.135.164.72\", ProxyPort=3128, keywords=[\"word1\", \"word2\"])\n\nfor video in client.getVideos(10, page=2):\n    print(video)\n    print(video[\"url\"])\n```\n\n#### Sort Video by parameter\n\nWhen keywords are set: `view`, `rate`, `long`, `recent` \n```python\nkeywords = [\"word1\", \"word2\"]\nclient = pornhub.PornHub(keywords)\n\nfor video in client.getVideos(10, page=2, sort_by=\"long\"):\n    print(video)\n    print(video[\"url\"])\n```\n\nWhen keywords are not set: `view`, `rate`, `long`, `new`, `hot`\n```python\nclient = pornhub.PornHub()\n\nfor video in client.getVideos(10, page=2, sort_by=\"hot\"):\n    print(video)\n    print(video[\"url\"])\n```\n\n#### Take full information about all videos\nParameter `full_data` allows you to get complete information about the video, but its much more slower due to every page needs to be opened\n\n```python\nkeywords = [\"word1\", \"word2\"]\nclient = pornhub.PornHub(keywords)\n\nfor video in client.getVideos(10, page=2, full_data=True):\n  print(video)\n  print(video[\"upload_date\"])\n```\n\n#### Get more information about the single video\n\nMethod `getVideo(url, viewkey)` gives more detail information about a single video\n\n```python\nclient = pornhub.PornHub()\n\n# You can input the full video url, like that\nvideo = client.getVideo(\"https://www.pornhub.com/view_video.php?viewkey=SOMEKEY\")\n# Or that\nvideo = client.getVideo(url=\"https://www.pornhub.com/view_video.php?viewkey=SOMEKEY\")\n# Or input only viewkey, like that\nvideo = client.getVideo(viewkey=\"SOMEKEY\")\n\nprint(video)\nprint(video[\"title\"])\n```\n\nThe method return a dictionary with keywords:\n1. `title` (type: string) - Video title\n2. `views` (type: string) - Rounded number of views, for example \"2M\"\n3. `accurate_views` (type: integer) - Full number of views, for example \"123456789\". When video don't have many views `views`=`accurate_views`\n4. `rating` (type: integer) - Video rating in percent\n5. `duration` (type: string) - Video duration in format \"hh:mm:ss\"\n6. `loaded` (type: string) - When the video was uploaded, for example \"2 months ago\"\n7. `upload_date` (type: string) - Video upload date in format \"yyyy-mm-dd\"\n8. `likes` (type: string) - Similar like `views`\n9. `accurate_likes` (type: integer) - Similar like `accurate_views`\n10. `dislikes` (type: string) - Similar like `views`\n11. `accurate_dislikes` (type: integer) - Similar like `accurate_views`\n12. `favorite` (type: string) - How many times added to favorites, rounded. For example \"2K\"\n13. `author` (type: string) - Video author (channel)\n14. `pornstars` (type: list) - Video stars\n15. `categories` (type: list) - Video categories\n16. `tags` (type: list) - Video tags\n17. `production` (type: string) - Video production (Professional or Homemade)\n19. `url` (type: string) - URL to Video\n18. `img_url` (type: string) - URL to Preview Image of Video\n19. `embed_url` (type: string) - URL to Video Player\n\nIf the video is not available in your country, in `title` will **\"Video not available in your country\"**, in others keys will `None`\n\n## Contributors\n\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/SashaSZ\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/88130296?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eSashaSZ\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/CprogrammerIbrahim\"\u003e\u003cimg src=\"https://avatars1.githubusercontent.com/u/40497100?s=400\u0026v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eIbrahim Ipek\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/kittinan\"\u003e\u003cimg src=\"https://avatars0.githubusercontent.com/u/144775?s=400\u0026v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eKittinan\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/fantomnotabene\"\u003e\u003cimg src=\"https://avatars2.githubusercontent.com/u/9576189?s=460\u0026u=7a9639ad287e7070220b22975dbab87b0228611f\u0026v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eЕлизаров Роман Русланович\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/IThinkImOKAY\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/61555147?s=460\u0026u=34c57df77de20121b0e298effe4092e32dd16ee1\u0026v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eIThinkImOKAY\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003ctable\u003e\n\n## License\n\nMIT license\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsskender%2Fpornhub-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsskender%2Fpornhub-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsskender%2Fpornhub-api/lists"}