eaf-base-api 2.2.7__tar.gz → 2.2.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {eaf_base_api-2.2.7/eaf_base_api.egg-info → eaf_base_api-2.2.9}/PKG-INFO +6 -5
- {eaf_base_api-2.2.7 → eaf_base_api-2.2.9}/README.md +5 -4
- eaf_base_api-2.2.9/base_api/__init__.py +5 -0
- {eaf_base_api-2.2.7 → eaf_base_api-2.2.9}/base_api/base.py +19 -19
- {eaf_base_api-2.2.7 → eaf_base_api-2.2.9/eaf_base_api.egg-info}/PKG-INFO +6 -5
- {eaf_base_api-2.2.7 → eaf_base_api-2.2.9}/setup.py +1 -1
- eaf_base_api-2.2.7/base_api/__init__.py +0 -4
- {eaf_base_api-2.2.7 → eaf_base_api-2.2.9}/LICENSE +0 -0
- {eaf_base_api-2.2.7 → eaf_base_api-2.2.9}/base_api/modules/__init__.py +0 -0
- {eaf_base_api-2.2.7 → eaf_base_api-2.2.9}/base_api/modules/config.py +0 -0
- {eaf_base_api-2.2.7 → eaf_base_api-2.2.9}/base_api/modules/progress_bars.py +0 -0
- {eaf_base_api-2.2.7 → eaf_base_api-2.2.9}/eaf_base_api.egg-info/SOURCES.txt +0 -0
- {eaf_base_api-2.2.7 → eaf_base_api-2.2.9}/eaf_base_api.egg-info/dependency_links.txt +0 -0
- {eaf_base_api-2.2.7 → eaf_base_api-2.2.9}/eaf_base_api.egg-info/requires.txt +0 -0
- {eaf_base_api-2.2.7 → eaf_base_api-2.2.9}/eaf_base_api.egg-info/top_level.txt +0 -0
- {eaf_base_api-2.2.7 → eaf_base_api-2.2.9}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: eaf_base_api
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.9
|
|
4
4
|
Summary: A base API for EchterAlsFake's Porn APIs
|
|
5
5
|
Home-page: https://github.com/EchterAlsFake/eaf_base_api
|
|
6
6
|
Author: Johannes Habel
|
|
@@ -35,10 +35,12 @@ support, and there was a lot of code that I would have rewritten in every API ag
|
|
|
35
35
|
package. The `BaseCore` class does all the necessary stuff like m3u8 parsing, a great caching system, network request
|
|
36
36
|
fetching with retry attempts and proxy support.
|
|
37
37
|
|
|
38
|
-
#
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
# Documentation (IMPORTANT!)
|
|
39
|
+
> [!IMPORTANT]
|
|
40
|
+
> Configuring eaf_base_api is necessary if you use any of my Porn APIs, because they all depend on this project.
|
|
41
|
+
> Please read through the documentation to learn how `PROXIES`, `CACHING` and `LOGGING` etc... work!
|
|
41
42
|
|
|
43
|
+
You can find the documentation here ->: https://github.com/EchterAlsFake/API_Docs/blob/master/Porn_APIs/eaf_base_api.md
|
|
42
44
|
|
|
43
45
|
# Can I use this for myself?
|
|
44
46
|
Yes, you can, but I may change stuff here and there from time to time, and it would maybe break your project.
|
|
@@ -47,7 +49,6 @@ I would not recommend you to install and use it as a package, but just copy the
|
|
|
47
49
|
I can recommend everyone the download functions for HLS streaming since, for example, the threaded preset is very well
|
|
48
50
|
optimized. If you just use mine, you need to consume less caffeine and brain cells to make such a function :)
|
|
49
51
|
|
|
50
|
-
|
|
51
52
|
# License
|
|
52
53
|
Licensed under The [LGPLv3](https://www.gnu.org/licenses/lgpl-3.0.en.html) license.
|
|
53
54
|
<br>Copyright (C) 2024-2025 Johannes Habel
|
|
@@ -9,10 +9,12 @@ support, and there was a lot of code that I would have rewritten in every API ag
|
|
|
9
9
|
package. The `BaseCore` class does all the necessary stuff like m3u8 parsing, a great caching system, network request
|
|
10
10
|
fetching with retry attempts and proxy support.
|
|
11
11
|
|
|
12
|
-
#
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
# Documentation (IMPORTANT!)
|
|
13
|
+
> [!IMPORTANT]
|
|
14
|
+
> Configuring eaf_base_api is necessary if you use any of my Porn APIs, because they all depend on this project.
|
|
15
|
+
> Please read through the documentation to learn how `PROXIES`, `CACHING` and `LOGGING` etc... work!
|
|
15
16
|
|
|
17
|
+
You can find the documentation here ->: https://github.com/EchterAlsFake/API_Docs/blob/master/Porn_APIs/eaf_base_api.md
|
|
16
18
|
|
|
17
19
|
# Can I use this for myself?
|
|
18
20
|
Yes, you can, but I may change stuff here and there from time to time, and it would maybe break your project.
|
|
@@ -21,7 +23,6 @@ I would not recommend you to install and use it as a package, but just copy the
|
|
|
21
23
|
I can recommend everyone the download functions for HLS streaming since, for example, the threaded preset is very well
|
|
22
24
|
optimized. If you just use mine, you need to consume less caffeine and brain cells to make such a function :)
|
|
23
25
|
|
|
24
|
-
|
|
25
26
|
# License
|
|
26
27
|
Licensed under The [LGPLv3](https://www.gnu.org/licenses/lgpl-3.0.en.html) license.
|
|
27
28
|
<br>Copyright (C) 2024-2025 Johannes Habel
|
|
@@ -5,7 +5,6 @@ import time
|
|
|
5
5
|
import m3u8
|
|
6
6
|
import json
|
|
7
7
|
import httpx
|
|
8
|
-
import random
|
|
9
8
|
import logging
|
|
10
9
|
import traceback
|
|
11
10
|
import threading
|
|
@@ -18,11 +17,11 @@ from ffmpeg_progress_yield import FfmpegProgress
|
|
|
18
17
|
from concurrent.futures import ThreadPoolExecutor, as_completed
|
|
19
18
|
|
|
20
19
|
try:
|
|
21
|
-
from modules import config
|
|
20
|
+
from modules.config import config
|
|
22
21
|
from modules.progress_bars import Callback
|
|
23
22
|
|
|
24
23
|
except (ModuleNotFoundError, ImportError):
|
|
25
|
-
from .modules import config
|
|
24
|
+
from .modules.config import config
|
|
26
25
|
from .modules.progress_bars import Callback
|
|
27
26
|
|
|
28
27
|
loggers = {}
|
|
@@ -62,7 +61,7 @@ class ColoredFormatter(logging.Formatter):
|
|
|
62
61
|
def send_log_message(ip, port, message):
|
|
63
62
|
"""Sends a log message to a remote server via HTTP."""
|
|
64
63
|
try:
|
|
65
|
-
conn = http.client.HTTPConnection(ip, port, timeout=
|
|
64
|
+
conn = http.client.HTTPConnection(ip, port, timeout=5)
|
|
66
65
|
headers = {'Content-Type': 'application/json'}
|
|
67
66
|
data = json.dumps({"message": message})
|
|
68
67
|
conn.request("POST", "/log", body=data, headers=headers)
|
|
@@ -143,12 +142,13 @@ class Cache:
|
|
|
143
142
|
self.cache_dictionary = {}
|
|
144
143
|
self.lock = threading.Lock()
|
|
145
144
|
self.logger = setup_logger("BASE API - [Cache]", level=logging.CRITICAL)
|
|
145
|
+
self.config = config
|
|
146
146
|
|
|
147
|
-
def enable_logging(self, log_file=None, level=logging.DEBUG):
|
|
147
|
+
def enable_logging(self, log_file=None, level=logging.DEBUG, log_ip=None, log_port=None):
|
|
148
148
|
"""
|
|
149
149
|
Enables logging dynamically for this module.
|
|
150
150
|
"""
|
|
151
|
-
self.logger = setup_logger(name="BASE API - [Cache]", log_file=log_file, level=level)
|
|
151
|
+
self.logger = setup_logger(name="BASE API - [Cache]", log_file=log_file, level=level, http_ip=log_ip, http_port=log_port)
|
|
152
152
|
|
|
153
153
|
def handle_cache(self, url):
|
|
154
154
|
if url is None:
|
|
@@ -160,7 +160,7 @@ class Cache:
|
|
|
160
160
|
|
|
161
161
|
def save_cache(self, url, content):
|
|
162
162
|
with self.lock:
|
|
163
|
-
if len(self.cache_dictionary.keys()) >=
|
|
163
|
+
if len(self.cache_dictionary.keys()) >= self.config.max_cache_items:
|
|
164
164
|
first_key = next(iter(self.cache_dictionary))
|
|
165
165
|
# Delete the first item
|
|
166
166
|
del self.cache_dictionary[first_key]
|
|
@@ -172,7 +172,7 @@ class BaseCore:
|
|
|
172
172
|
"""
|
|
173
173
|
The base class which has all necessary functions for other API packages
|
|
174
174
|
"""
|
|
175
|
-
def __init__(self, config=config
|
|
175
|
+
def __init__(self, config=config):
|
|
176
176
|
self.last_request_time = time.time()
|
|
177
177
|
self.total_requests = 0 # Tracks how many requests have been made
|
|
178
178
|
self.session = None
|
|
@@ -182,12 +182,12 @@ class BaseCore:
|
|
|
182
182
|
self.initialize_session()
|
|
183
183
|
self.logger = setup_logger("BASE API - [BaseCore]", log_file=False, level=logging.ERROR)
|
|
184
184
|
|
|
185
|
-
def enable_logging(self, log_file=None, level=logging.DEBUG):
|
|
185
|
+
def enable_logging(self, log_file=None, level=logging.DEBUG, log_ip=None, log_port=None):
|
|
186
186
|
"""
|
|
187
187
|
Enables logging dynamically for this module.
|
|
188
188
|
"""
|
|
189
|
-
self.logger = setup_logger(name="BASE API - [BaseCore]", log_file=log_file, level=level)
|
|
190
|
-
self.cache.logger = setup_logger(name="BASE API - [Cache]", log_file=log_file, level=level)
|
|
189
|
+
self.logger = setup_logger(name="BASE API - [BaseCore]", log_file=log_file, level=level, http_ip=log_ip, http_port=log_port)
|
|
190
|
+
self.cache.logger = setup_logger(name="BASE API - [Cache]", log_file=log_file, level=level, http_ip=log_ip, http_port=log_port)
|
|
191
191
|
|
|
192
192
|
def update_user_agent(self):
|
|
193
193
|
"""Updates the User-Agent"""
|
|
@@ -200,7 +200,7 @@ class BaseCore:
|
|
|
200
200
|
self.kill_switch = True
|
|
201
201
|
|
|
202
202
|
def check_kill_switch(self):
|
|
203
|
-
proxy_ip = self.config.
|
|
203
|
+
proxy_ip = self.config.proxy
|
|
204
204
|
pattern = re.compile(
|
|
205
205
|
r'^(?P<scheme>http|socks5)://'
|
|
206
206
|
r'(?:(?:\w+:\w+)@)?' # optional user:pass@
|
|
@@ -233,16 +233,16 @@ class BaseCore:
|
|
|
233
233
|
|
|
234
234
|
def initialize_session(self, verify=True): # Disable SSL verification only if you really need it....
|
|
235
235
|
self.session = httpx.Client(
|
|
236
|
-
proxy=self.config.
|
|
237
|
-
headers=self.config.
|
|
238
|
-
timeout=self.config.
|
|
236
|
+
proxy=self.config.proxy,
|
|
237
|
+
headers=self.config.headers,
|
|
238
|
+
timeout=self.config.timeout,
|
|
239
239
|
follow_redirects=True,
|
|
240
240
|
verify=verify
|
|
241
241
|
)
|
|
242
242
|
|
|
243
243
|
def enforce_delay(self):
|
|
244
244
|
"""Enforces the specified delay in consts.REQUEST_DELAY"""
|
|
245
|
-
delay = self.config.
|
|
245
|
+
delay = self.config.request_delay
|
|
246
246
|
if delay > 0:
|
|
247
247
|
time_since_last_request = time.time() - self.last_request_time
|
|
248
248
|
self.logger.debug(f"Time since last request: {time_since_last_request:.2f} seconds.")
|
|
@@ -276,7 +276,7 @@ class BaseCore:
|
|
|
276
276
|
self.logger.info(f"Fetched content for: {url} from cache!")
|
|
277
277
|
return content
|
|
278
278
|
|
|
279
|
-
for attempt in range(1, self.config.
|
|
279
|
+
for attempt in range(1, self.config.max_retries + 1):
|
|
280
280
|
if attempt != 1:
|
|
281
281
|
time.sleep(1.5) # Sleeping for 1.5 seconds to minimize site overload when doing a lot of requests
|
|
282
282
|
|
|
@@ -342,9 +342,9 @@ class BaseCore:
|
|
|
342
342
|
except Exception:
|
|
343
343
|
self.logger.error(f"Attempt {attempt}: Unexpected error for URL {url}: {traceback.format_exc()}")
|
|
344
344
|
|
|
345
|
-
self.logger.info(f"Retrying ({attempt}/{self.config.
|
|
345
|
+
self.logger.info(f"Retrying ({attempt}/{self.config.max_retries}) for URL: {url}")
|
|
346
346
|
|
|
347
|
-
self.logger.error(f"Failed to fetch URL {url} after {self.config.
|
|
347
|
+
self.logger.error(f"Failed to fetch URL {url} after {self.config.max_retries} attempts.")
|
|
348
348
|
return None # Return None if all attempts fail
|
|
349
349
|
|
|
350
350
|
@classmethod
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: eaf_base_api
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.9
|
|
4
4
|
Summary: A base API for EchterAlsFake's Porn APIs
|
|
5
5
|
Home-page: https://github.com/EchterAlsFake/eaf_base_api
|
|
6
6
|
Author: Johannes Habel
|
|
@@ -35,10 +35,12 @@ support, and there was a lot of code that I would have rewritten in every API ag
|
|
|
35
35
|
package. The `BaseCore` class does all the necessary stuff like m3u8 parsing, a great caching system, network request
|
|
36
36
|
fetching with retry attempts and proxy support.
|
|
37
37
|
|
|
38
|
-
#
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
# Documentation (IMPORTANT!)
|
|
39
|
+
> [!IMPORTANT]
|
|
40
|
+
> Configuring eaf_base_api is necessary if you use any of my Porn APIs, because they all depend on this project.
|
|
41
|
+
> Please read through the documentation to learn how `PROXIES`, `CACHING` and `LOGGING` etc... work!
|
|
41
42
|
|
|
43
|
+
You can find the documentation here ->: https://github.com/EchterAlsFake/API_Docs/blob/master/Porn_APIs/eaf_base_api.md
|
|
42
44
|
|
|
43
45
|
# Can I use this for myself?
|
|
44
46
|
Yes, you can, but I may change stuff here and there from time to time, and it would maybe break your project.
|
|
@@ -47,7 +49,6 @@ I would not recommend you to install and use it as a package, but just copy the
|
|
|
47
49
|
I can recommend everyone the download functions for HLS streaming since, for example, the threaded preset is very well
|
|
48
50
|
optimized. If you just use mine, you need to consume less caffeine and brain cells to make such a function :)
|
|
49
51
|
|
|
50
|
-
|
|
51
52
|
# License
|
|
52
53
|
Licensed under The [LGPLv3](https://www.gnu.org/licenses/lgpl-3.0.en.html) license.
|
|
53
54
|
<br>Copyright (C) 2024-2025 Johannes Habel
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|