Skip to content

Latest commit

 

History

History
291 lines (202 loc) · 6.04 KB

Documentation.md

File metadata and controls

291 lines (202 loc) · 6.04 KB

EPorner Documentation

  • Version 1.6
  • Author: Johannes Habel
  • Copyright (C) 2024
  • License: LGPLv3
  • Dependencies: requests, lxml, bs4, eaf_base_api

Important Notice

The ToS of Eporner.com clearly say that using scrapers / bots isn't allowed.
This API uses primarily the official Webmasters API which is in compliance to the ToS.


However, there are more features that can be enabled using the function parameters.
The function parameter is called enable_html_scraping. This parameter is by default
set to False. However, you can set it to True to enable all features.

If you are using this, you may face legal actions, so it's at your own risk!

Table of Contents

Importing the API

from eporner_api.eporner_api import Client, Quality
from eporner_api.modules.errors import *  # These are the exceptions
from eporner_api.modules.sorting import *  # These are sorting used for searching

Video Object

The video object has the following attributes:

from eporner_api.eporner_api import Client, Quality, Encoding

client = Client()
video = client.get_video("<video_url>", enable_html_scraping=False)
"""
Set Enable HTML Scraping to True, if you need more information.
Downloading Videos is only possible if you enabled HTML Scraping!
"""

# Now you access video attributes like

print(video.title)
print(video.length_seconds)

# etc...

# Downloading a Video (HTML Scraping needs to be enabled!)

video.download(quality=Quality.BEST, path="./", mode=Encoding.mp4_h264)

Video Information

Webmasters

  • Video ID
  • Tags
  • Title
  • Views
  • Rate
  • Publish Date
  • Length (Seconds)
  • Length (Minutes)
  • Embed URL (to embed the video in a website)

HTML Content

  • Bitrate
  • Source video URL (you probably never need this)
  • Rating
  • Rating Count
  • Thumbnail
  • Pornstars (their videos and some information)

Functions

  • direct_download_link() # Returns the direct download URL
  • download()

Downloading a Video

Please See Locals

You can download a video by using video.downlod_video()

Arguments:

  • quality : must be a Quality object
  • path : must be a string for an output location
  • mode : must be an Encoding object

Custom Callback

If you want to use a custom callback function, you can do so, by specifying your function in the callback argument.

Your function needs to take the arguments pos and total

  • pos: The current progress
  • total: The total filesize

The Pornstar Object

It's as simple as doing:

from eporner_api.eporner_api import Client
client = Client()
pornstar = client.get_pornstar("https://www.eporner.com/pornstar/riley-reid/", enable_html_scraping=True)
videos = pornstar.videos(pages=2)

# Now you can iterate through videos

for video in videos:
    print(video.title) # or download them, etc...

The Pornstar Object contains all information from the EPorner Pornstar page

Searching for Videos

You can search videos using

from eporner_api.eporner_api import Client

client = Client()
videos = client.search_videos(query, etc...)

for video in videos:
    print(video.title)
    # etc...

Arguments:

  • query: The search Query (str)
  • page: How many pages to iterate (int)
  • per_page: How many videos per page (int)
  • sorting_order: Order Object
  • sorting_gay: Gay Object
  • sorting_low_quality: Low Quality Object
  • enable_html_scraping : Important Notice

Returns a Video Object (as a Generator)

Videos by Category

You can also get Videos by a Category

from eporner_api.eporner_api import Client, Category

videos = Client().get_videos_by_category(category=Category.ASIAN) # or something else,

# INFO: You can also pass the category as a string like it would be in the url.

for video in videos:
  print(video.title)

Arguments:

  • pages: Over how many pages to iterate. One page contains 63 videos
  • enable_html_scraping: If the returned Video objects should have html scraping enabled

Locals

Quality

The Quality object has three types:

  • BEST
  • HALF
  • WORST

(I think they explain themselves good enough :)

You can also pass a string instead of the object.

  • For Quality.BEST: best
  • For Quality.HALF: half
  • For Quality.WORST: ẁorst
from base_api.modules.quality import Quality

quality = Quality.BEST
quality = Quality.HALF
quality = Quality.WORST 

# or 

quality = "best" # etc...

Encoding

Videos on EPorner are available in AV1 and MP4 (H264) format.
I recommend MP4 (H264)

from eporner_api.modules.locals import Encoding

encoding = Encoding.mp4_h264 # Recommended!
encoding = Encoding.av1

Sorting

The sorting objects are needed for searching.

Order

  • latest
  • longest
  • shortest
  • top_rated
  • most_popular
  • top_weekly
  • top_monthly
from eporner_api.modules.sorting import Order

order = Order.latest
# etc...

Gay

  • exclude_gay_content
  • include_gay_content
  • only_gay_content
from eporner_api.modules.sorting import Gay

gay = Gay.exclude_gay_content
# etc...

LowQuality

  • exclude_low_quality_content
  • include_low_quality_content
  • only_low_quality_content
from eporner_api.modules.sorting import LowQuality

quality_sorting = LowQuality.exclude_low_quality_content
# etc...

Category

All categories are in the Category class.

from eporner_api.modules.locals import Category
Category.AMATEUR
Category.ASMR 

# etc...