===============================
Unofficial api for pornhub.com
===============================
.. image:: https://travis-ci.org/derfirm/pornhub-api.svg?branch=master
:target: https://travis-ci.org/derfirm/pornhub-api
.. image:: https://api.codacy.com/project/badge/Grade/72b5baaa2a7d438cbe725924954a62b2
:target: https://www.codacy.com/manual/Derfirm/pornhub-api
.. image:: https://img.shields.io/pypi/v/pornhub-api.svg
:target: https://pypi.python.org/pypi/pornhub-api
Key Features
____________
- response are fully-annotated with pydantic_
- rest without parsing
.. _pydantic: https://pydantic-docs.helpmanual.io/
Installing
__________
.. code:: bash
$ pip install pornhub-api
or with aiohttp support
.. code:: bash
$ pip install pornhub-api[aiohttp-backend]
or with httpx support
.. code:: bash
$ pip install pornhub-api[httpx-backend]
Supported versions
__________________
- Python 3.7+
Getting started
===============
Initiate Api client
___________________
.. code-block:: python
from pornhub_api import PornhubApi
api = PornhubApi()
Initiate with AioHttp backend
_____________________________
.. code-block:: python
import asyncio
from pornhub_api.backends.aiohttp import AioHttpBackend
async def execute():
async with AioHttpBackend() as backend:
api = PornhubApi(backend=backend)
video = await api.video.get_by_id("ph560b93077ddae")
print(video.title)
asyncio.run(execute())
Search Videos
_____________
.. code-block:: python
videos = api.search_videos.search_videos(
"chechick",
ordering="mostviewed",
period="weekly",
tags=["black"],
)
for vid in videos:
print(vid.title, vid.video_id)
Get Stars
___________
.. code-block:: python
api.stars.all()
or
api.stats.all_detailed()
Get single Video details
________________________
.. code-block:: python
video = api.video.get_by_id("ph560b93077ddae")
print(video.title)
Get all videos tags or categories
_________________________________
.. code-block:: python
categories = api.video.categories()
tags = api.video.tags("a")
Check Video availability
_________________________
.. code-block:: python
response = api.video.is_active("ph560b93077ddae")
print(response.is_active)
Search video by random tag and category
_______________________________________
.. code-block:: python
import random
api = PornhubApi()
tags = random.sample(api.video.tags("f").tags, 5)
category = random.choice(api.video.categories().categories)
result = api.search.search_videos(ordering="mostviewed", tags=tags, category=category)
print(result.size())
for vid in result:
print(vid.title, vid.url)
Raw data
{
"_id": null,
"home_page": "https://github.com/Derfirm/pornhub_api",
"name": "pornhub-api",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8,<3.12",
"maintainer_email": "",
"keywords": "pornhub,pornhub-api,api-wrapper",
"author": "Andrew Grinevich",
"author_email": "beule@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/f7/61/25220dbaf61d1ca9ac3d4e5968c74f3741dde085c33cdd38bd10dd4932da/pornhub_api-0.3.0.tar.gz",
"platform": null,
"description": "===============================\nUnofficial api for pornhub.com\n===============================\n\n.. image:: https://travis-ci.org/derfirm/pornhub-api.svg?branch=master\n :target: https://travis-ci.org/derfirm/pornhub-api\n\n.. image:: https://api.codacy.com/project/badge/Grade/72b5baaa2a7d438cbe725924954a62b2\n :target: https://www.codacy.com/manual/Derfirm/pornhub-api\n\n.. image:: https://img.shields.io/pypi/v/pornhub-api.svg\n :target: https://pypi.python.org/pypi/pornhub-api\n\n\nKey Features\n____________\n- response are fully-annotated with pydantic_\n- rest without parsing\n\n.. _pydantic: https://pydantic-docs.helpmanual.io/\n\n\nInstalling\n__________\n.. code:: bash\n\n $ pip install pornhub-api\n\nor with aiohttp support\n\n.. code:: bash\n\n $ pip install pornhub-api[aiohttp-backend]\n\nor with httpx support\n\n.. code:: bash\n\n $ pip install pornhub-api[httpx-backend]\n\nSupported versions\n__________________\n- Python 3.7+\n\n\nGetting started\n===============\nInitiate Api client\n___________________\n.. code-block:: python\n\n from pornhub_api import PornhubApi\n\n api = PornhubApi()\n\nInitiate with AioHttp backend\n_____________________________\n\n.. code-block:: python\n\n import asyncio\n from pornhub_api.backends.aiohttp import AioHttpBackend\n\n\n async def execute():\n async with AioHttpBackend() as backend:\n api = PornhubApi(backend=backend)\n video = await api.video.get_by_id(\"ph560b93077ddae\")\n print(video.title)\n\n asyncio.run(execute())\n\n\nSearch Videos\n_____________\n.. code-block:: python\n\n videos = api.search_videos.search_videos(\n \"chechick\",\n ordering=\"mostviewed\",\n period=\"weekly\",\n tags=[\"black\"],\n )\n for vid in videos:\n print(vid.title, vid.video_id)\n\nGet Stars\n___________\n.. code-block:: python\n\n api.stars.all()\n or\n api.stats.all_detailed()\n\n\n\nGet single Video details\n________________________\n.. code-block:: python\n\n video = api.video.get_by_id(\"ph560b93077ddae\")\n print(video.title)\n\n\nGet all videos tags or categories\n_________________________________\n.. code-block:: python\n\n categories = api.video.categories()\n tags = api.video.tags(\"a\")\n\n\nCheck Video availability\n_________________________\n.. code-block:: python\n\n response = api.video.is_active(\"ph560b93077ddae\")\n print(response.is_active)\n\n\nSearch video by random tag and category\n_______________________________________\n.. code-block:: python\n\n\n import random\n api = PornhubApi()\n\n tags = random.sample(api.video.tags(\"f\").tags, 5)\n category = random.choice(api.video.categories().categories)\n result = api.search.search_videos(ordering=\"mostviewed\", tags=tags, category=category)\n\n print(result.size())\n for vid in result:\n print(vid.title, vid.url)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "",
"version": "0.3.0",
"split_keywords": [
"pornhub",
"pornhub-api",
"api-wrapper"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "68448958074bdc429e552cfd181b84fb65d6ca722079ce3424b5ad85ca8173c9",
"md5": "c5f7d7fcdb9a6cbd88d0b6b4295ded77",
"sha256": "9618986cafd4404f75416de203e6b134ef7162fa3de237f45031bc008ffa0a54"
},
"downloads": -1,
"filename": "pornhub_api-0.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c5f7d7fcdb9a6cbd88d0b6b4295ded77",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<3.12",
"size": 14168,
"upload_time": "2023-03-20T11:06:06",
"upload_time_iso_8601": "2023-03-20T11:06:06.758875Z",
"url": "https://files.pythonhosted.org/packages/68/44/8958074bdc429e552cfd181b84fb65d6ca722079ce3424b5ad85ca8173c9/pornhub_api-0.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f76125220dbaf61d1ca9ac3d4e5968c74f3741dde085c33cdd38bd10dd4932da",
"md5": "2b714c23d635ac96b06dc08e67dfa470",
"sha256": "e18c58bbda1b89c07cb40a3e020fde4e77eeec9a20c407064b5dae1f2dbc8345"
},
"downloads": -1,
"filename": "pornhub_api-0.3.0.tar.gz",
"has_sig": false,
"md5_digest": "2b714c23d635ac96b06dc08e67dfa470",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<3.12",
"size": 8332,
"upload_time": "2023-03-20T11:06:08",
"upload_time_iso_8601": "2023-03-20T11:06:08.592752Z",
"url": "https://files.pythonhosted.org/packages/f7/61/25220dbaf61d1ca9ac3d4e5968c74f3741dde085c33cdd38bd10dd4932da/pornhub_api-0.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-03-20 11:06:08",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "Derfirm",
"github_project": "pornhub_api",
"lcname": "pornhub-api"
}