From 1dbf7122335aba0b5b8ef3bb599978a49e07fc85 Mon Sep 17 00:00:00 2001 From: Johannes Habel Date: Fri, 16 Aug 2024 07:01:56 +0200 Subject: [PATCH] optimized imports --- README.md | 3 +-- README/Documentation.md | 14 +++++++------- xnxx_api/__init__.py | 10 ++++++++++ xnxx_api/xnxx_api.py | 3 +-- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 73a333c..f64ccce 100644 --- a/README.md +++ b/README.md @@ -25,8 +25,7 @@ XNXX API is an API for xnxx.com. It allows you to fetch information from videos ```python -from xnxx_api.xnxx_api import Client, Quality -from base_api.modules.download import threaded, default, FFMPEG +from xnxx_api import Client, Quality, threaded, default, FFMPEG # Initialize a Client object client = Client() diff --git a/README/Documentation.md b/README/Documentation.md index 74f06de..6f81149 100644 --- a/README/Documentation.md +++ b/README/Documentation.md @@ -30,8 +30,7 @@ #### To import all modules, you should use the following: ```python -from base_api.modules.quality import * -from xnxx_api.xnxx_api import * +from xnxx_api import Client, Quality ``` # Initializing the Client @@ -123,11 +122,12 @@ When downloading a video, you can just specify your callback functions in the `c # Searching ```python -from xnxx_api.xnxx_api import Client -from xnxx_api.modules.search_filters import UploadTime, SearchingQuality, Length +from xnxx_api import Client +from xnxx_api import search_filters client = Client() -search = client.search("", upload_time=UploadTime.month, length=Length.X_0_10min, searching_quality=SearchingQuality.X_720p) +search = client.search("", upload_time=search_filters.UploadTime.month, length=search_filters.Length.X_0_10min, + searching_quality=search_filters.SearchingQuality.X_720p) # this is an example for video in search.videos: @@ -189,11 +189,11 @@ Currently, there are three filters available: They are located in: ```python -from xnxx_api.modules.search_filters import UploadTime, SearchingQuality, Length +from xnxx_api import search_filters from xnxx_api.xnxx_api import Client # Use them like this: -search = Client().search("", length=Length.X_0_10min, upload_time=UploadTime.year, searching_quality=SearchingQuality.X_1080p_plus) +search = Client().search("", length=search_filters.Length.X_0_10min, upload_time=search_filters.UploadTime.year, searching_quality=search_filters.SearchingQuality.X_1080p_plus) videos = search.videos # I think the names explain what it does :) ``` \ No newline at end of file diff --git a/xnxx_api/__init__.py b/xnxx_api/__init__.py index e69de29..e136bdc 100644 --- a/xnxx_api/__init__.py +++ b/xnxx_api/__init__.py @@ -0,0 +1,10 @@ +# xnxx_api/__init__.py + +__all__ = [ + "Client", "Core", "Quality", "Video", "Callback", "threaded", "default", "FFMPEG", + "errors", "consts", "search_filters", "category" +] + +# Public API from xnxx_api.py +from xnxx_api.xnxx_api import Client, Core, Quality, Video, Callback, threaded, default, FFMPEG +from xnxx_api.modules import errors, consts, category, search_filters \ No newline at end of file diff --git a/xnxx_api/xnxx_api.py b/xnxx_api/xnxx_api.py index 0a55a4c..699c8e2 100644 --- a/xnxx_api/xnxx_api.py +++ b/xnxx_api/xnxx_api.py @@ -14,8 +14,7 @@ from bs4 import BeautifulSoup from functools import cached_property -from base_api.base import Core, Quality -from base_api.modules.progress_bars import Callback +from base_api import Core, Quality, threaded, default, FFMPEG, Callback, setup_api base_qualities = ["250p", "360p", "480p", "720p", "1080p", "1440p", "2160p"]