Skip to main content

A Python API for the Porn Site HQPorner.com

Project description

HQPorner API

Table of contents

Description

HQPorner API is an API written for the Porn site hqporner.com
It can retrieve data by extracting them from the HTML code
with Beautifulsoup and requests.

Please note that web scarping isn't allowed in most cases!
Consider using a VPN when using this API

Installation

# Installing via PyPi

pip install --upgrade hqporner_api

# Installing from GitHub to get latest version

pip install git+https://github.com/EchterAlsFake/hqporner_api.git

Usage

Import the package:

from hqporner_api.api import API

Arguments

  • URL: Must be URL of hqporner.com ending with .html

  • Quality:

    • 360 : Returns 360p quality video
    • 720 : Returns 720p quality video
    • 1080 : Returns 1080p quality video
    • 2160 : Returns 2160p quality video
    • 'highest': Returns highest quality available (Recommended!)
  • Path: Where the video should be stored in

  • File: Location of the file containing urls. Separated by new lines!

Get the title of the video

title = API().extract_title(url)

Get the actresses of the video

actress = API().extract_actress(url) # Returns a list of actresses (string)

Get direct download URLs

url = API().get_direct_url(url, quality) # Returns URL for given quality

Download the video

API().download(url, quality, path) # Downloads the video with a tqdm progressbar

Note: Download speeds can be slow if the CDN Network is slow.

Download from file

API().download(file, quality, path) # Downloads all urls from file. Separate URLs with new line

Get length of the video

API().get_length(url) # Returns video length (string)

Get publish date of the video

API().get_publish_date(url) # Returns the publish date (string)

Get categories of the video

API().get_categories(url) # Returns a list with categories (string)

Get total file size

API().get_total_size(url, quality) # Returns the file size (int)

Exceptions are in exceptions.py, but they aren't really well implemented yet.

Callback

HQPorner API uses a tqdm progressbar by default. You can specify your own custom progressbar with

API().download(...., callback=your_custom_progressbar)

This will return pos (current progress) and total to the custom function.
Here's an Example:

def custom_callback(self, downloaded, total, identifier): # The identifier just returns "hqporner" and can be ignored!
    """This is an example of how you can implement the custom callback"""

    percentage = (downloaded / total) * 100
    print(f"Downloaded: {downloaded} bytes / {total} bytes ({percentage:.2f}%)")

License

Licensed under the LGPLv3 License

Copyright (C) 2023 EchterAlsFake

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

hqporner_api-0.8.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

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

hqporner_api-0.8-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file hqporner_api-0.8.tar.gz.

File metadata

  • Download URL: hqporner_api-0.8.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for hqporner_api-0.8.tar.gz
Algorithm Hash digest
SHA256 7b024691b6d1ce64ecd1fe4d157398d4101fbf9b3e66568f2e83d9b91bf714b0
MD5 c32b1dab2475a7bb05e3511e218977d7
BLAKE2b-256 70f1e0444ac2be7515391c9a09f6d16ebbd0207d845e95ade1f3e7984945ea6c

See more details on using hashes here.

File details

Details for the file hqporner_api-0.8-py3-none-any.whl.

File metadata

  • Download URL: hqporner_api-0.8-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for hqporner_api-0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 058f87b6ed9b6ec390dde4ef04b8098ef06bea5a9a45e31874dc72120da42c14
MD5 80a572188e2873177f76eaa5b70a1848
BLAKE2b-256 32c2971305b9afea1c9722c8467323e3121fc9ec1e83f3c3414817d4219ecff9

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