Skip to main content

No project description provided

Project description

https://travis-ci.org/derfirm/pornhub-api.svg?branch=master https://api.codacy.com/project/badge/Grade/72b5baaa2a7d438cbe725924954a62b2 https://img.shields.io/pypi/v/pornhub-api.svg

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)

Get all videos tags or categories

categories = api.video.categories()
tags = api.video.tags("a")

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


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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pornhub_api-0.2.0-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file pornhub-api-0.2.0.tar.gz.

File metadata

  • Download URL: pornhub-api-0.2.0.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.7.6 Linux/4.15.0-96-generic

File hashes

Hashes for pornhub-api-0.2.0.tar.gz
Algorithm Hash digest
SHA256 4cb605a23ed79bbab5bf47d9df7578b7b017cfae782199368a3f47d54ad929b3
MD5 b6772fc8ca8d7fc4d83a94ef3c5ad4a6
BLAKE2b-256 fb62d63888f03322e11c2ccc0d96782beaf4be85f06dbf2717d8aa57d1ee0c87

See more details on using hashes here.

File details

Details for the file pornhub_api-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pornhub_api-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.7.6 Linux/4.15.0-96-generic

File hashes

Hashes for pornhub_api-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f9fe06139a2b897da99e97b82210b35ec26464f620ba3daea281909dbdfa054d
MD5 e675860d1b12d027b42d260584b9df4f
BLAKE2b-256 b626f21eb7848d4296303ee8e95c15396f869250fef3b158a6a9773c2d0272f4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page