All providers / unofficial-api-for-pornhub
Pornhub API.
Retrieve Pornhub video metadata, tags, and category records with an async Python client.
Unofficial Python library · v6.0.3 · AGPL-3.0-only
pip install unofficial-api-for-pornhubSearch Pornhub videos by production type
Search for interviews, keep professional productions, and sort by most viewed. Print the video URLs from the first page.
After installing the package above, save this as example.py
and run python example.py.
import asyncio
from pornhub_api import Client
async def main():
client = Client()
try:
results = client.search_videos(
query="interview",
production_type="professional",
sort_by="mv",
pages=1,
)
async for result in results:
video = result.unwrap()
print(video.url)
finally:
await client.core.close()
asyncio.run(main())Expected output
One matching video URL per line. An empty first page produces no lines.
What you can build with Pornhub
- Fetch videos
Client.get_video() - Search videos
Client.search_videos() - Fetch channels
Client.get_channel() - Fetch pornstar profiles
Client.get_pornstar() - Fetch model profiles
Client.get_model() - Fetch playlists
Client.get_playlist() - Fetch albums
Client.get_album() - Fetch shorts
Client.get_short() - Fetch GIFs
Client.get_gif() - Download videos
Video.download()
Metadata fields
titledurationtagsviewscategorieslikespublish_dateavailable_qualitiesauthor_namerating_percent
The API loader supplies title, duration, and tags. Enable HTML loading for uploader details and advertised qualities.
Release and tests
Release 6.0.3 was published on 2026-11-27. Inspect the published distribution, source, and tests for this integration.
Integrating commercially?
The library is free under AGPL-3.0-only. Email me to discuss alternative commercial terms.
Ask about a commercial license ↗