No project description provided
Project description
Key Features
response are fully-annotated with pydantic
rest without parsing
Installing
$ pip install pornhub-api
or with aiohttp support
$ pip install pornhub-api[aiohttp-backend]
or with httpx support
$ pip install pornhub-api[httpx-backend]
Supported versions
Python 3.7+
Getting started
Initiate Api client
from pornhub_api import PornhubApi
api = PornhubApi()
Initiate with AioHttp backend
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
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
api.stars.all()
or
api.stats.all_detailed()
Get single Video details
video = api.video.get_by_id("ph560b93077ddae")
print(video.title)
Check Video availability
response = api.video.is_active("ph560b93077ddae")
print(response.is_active)
Search video by random tag and category
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)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pornhub_api-0.3.0.tar.gz
(8.3 kB
view hashes)
Built Distribution
Close
Hashes for pornhub_api-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9618986cafd4404f75416de203e6b134ef7162fa3de237f45031bc008ffa0a54 |
|
MD5 | c5f7d7fcdb9a6cbd88d0b6b4295ded77 |
|
BLAKE2b-256 | 68448958074bdc429e552cfd181b84fb65d6ca722079ce3424b5ad85ca8173c9 |