No project description provided
Project description
Key Features
response are fully-annotated with pydantic
rest without parsing
Installing
$ pip install pornhub-api
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():
backend = AioHttpBackend()
api = PornhubApi(backend=backend)
response = await api.video.get_by_id("ph560b93077ddae")
print(response.video.title)
await backend.close()
asyncio.run(execute())
Search Videos
data = api.search.search(
"chechick",
ordering="mostviewed",
period="weekly",
tags=["black"],
)
for vid in data.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").video
print(video.title)
Check Video availability
response = api.video.is_active("ph560b93077ddae")
print(response.active.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(ordering="mostviewed", tags=tags, category=category)
print(result.size())
for vid in result.videos:
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.2.0.tar.gz
(7.8 kB
view hashes)
Built Distribution
Close
Hashes for pornhub_api-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9fe06139a2b897da99e97b82210b35ec26464f620ba3daea281909dbdfa054d |
|
MD5 | e675860d1b12d027b42d260584b9df4f |
|
BLAKE2b-256 | b626f21eb7848d4296303ee8e95c15396f869250fef3b158a6a9773c2d0272f4 |