eaf-base-api 2.3.4__tar.gz → 2.3.6__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: eaf_base_api
3
- Version: 2.3.4
3
+ Version: 2.3.6
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
@@ -326,7 +326,26 @@ class BaseCore:
326
326
 
327
327
  # Process and return content
328
328
  # Collecting all chunks before processing because some sites cause issues with real-time decoding
329
- raw_content = response.content
329
+ if self.config.max_bandwidth_mb is not None and self.config.max_bandwidth_mb >= 0.2:
330
+ raw_content = bytearray()
331
+ chunk_size = 64 * 1024 # 64 KB
332
+ speed_limit = self.config.max_bandwidth_mb * 1024 * 1024
333
+ min_time_per_chunk = chunk_size / speed_limit
334
+ start_time = time.time()
335
+
336
+ for chunk in response.iter_bytes(chunk_size=chunk_size):
337
+ raw_content.extend(chunk)
338
+ elapsed = time.time() - start_time
339
+ sleep_time = min_time_per_chunk - elapsed
340
+ if sleep_time > 0:
341
+ time.sleep(sleep_time)
342
+
343
+ start_time = time.time()
344
+
345
+ raw_content = bytes(raw_content)
346
+
347
+ else:
348
+ raw_content = response.content
330
349
 
331
350
  if get_bytes:
332
351
  content = raw_content
@@ -6,6 +6,7 @@ class RuntimeConfig:
6
6
  self.max_retries = 4
7
7
  self.request_delay = 0
8
8
  self.timeout = 20
9
+ self.max_bandwidth_mb = None # Set speed limit in megabytes per second e.g, 2.0, 3.5 etc...
9
10
  self.ffmpeg_path = "ffmpeg"
10
11
  self.proxy = None
11
12
  self.verify_ssl = True
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: eaf_base_api
3
- Version: 2.3.4
3
+ Version: 2.3.6
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
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="eaf_base_api",
5
- version="2.3.4",
5
+ version="2.3.6",
6
6
  packages=find_packages(),
7
7
  install_requires=["m3u8", "httpx"],
8
8
  extras_require={
File without changes
File without changes
File without changes