eaf-base-api 2.4.4__tar.gz → 2.4.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.
- {eaf_base_api-2.4.4/eaf_base_api.egg-info → eaf_base_api-2.4.6}/PKG-INFO +1 -1
- {eaf_base_api-2.4.4 → eaf_base_api-2.4.6}/base_api/base.py +13 -5
- {eaf_base_api-2.4.4 → eaf_base_api-2.4.6}/base_api/modules/config.py +4 -0
- {eaf_base_api-2.4.4 → eaf_base_api-2.4.6/eaf_base_api.egg-info}/PKG-INFO +1 -1
- {eaf_base_api-2.4.4 → eaf_base_api-2.4.6}/pyproject.toml +1 -1
- {eaf_base_api-2.4.4 → eaf_base_api-2.4.6}/LICENSE +0 -0
- {eaf_base_api-2.4.4 → eaf_base_api-2.4.6}/MANIFEST.in +0 -0
- {eaf_base_api-2.4.4 → eaf_base_api-2.4.6}/README.md +0 -0
- {eaf_base_api-2.4.4 → eaf_base_api-2.4.6}/base_api/__init__.py +0 -0
- {eaf_base_api-2.4.4 → eaf_base_api-2.4.6}/base_api/modules/__init__.py +0 -0
- {eaf_base_api-2.4.4 → eaf_base_api-2.4.6}/base_api/modules/errors.py +0 -0
- {eaf_base_api-2.4.4 → eaf_base_api-2.4.6}/base_api/modules/progress_bars.py +0 -0
- {eaf_base_api-2.4.4 → eaf_base_api-2.4.6}/eaf_base_api.egg-info/SOURCES.txt +0 -0
- {eaf_base_api-2.4.4 → eaf_base_api-2.4.6}/eaf_base_api.egg-info/dependency_links.txt +0 -0
- {eaf_base_api-2.4.4 → eaf_base_api-2.4.6}/eaf_base_api.egg-info/requires.txt +0 -0
- {eaf_base_api-2.4.4 → eaf_base_api-2.4.6}/eaf_base_api.egg-info/top_level.txt +0 -0
- {eaf_base_api-2.4.4 → eaf_base_api-2.4.6}/setup.cfg +0 -0
|
@@ -658,8 +658,8 @@ class BaseCore:
|
|
|
658
658
|
def initialize_session(self):
|
|
659
659
|
limits = httpx.Limits(
|
|
660
660
|
max_connections=getattr(self.config, "max_connections", 128),
|
|
661
|
-
max_keepalive_connections=getattr(self.config, "max_keepalive",
|
|
662
|
-
keepalive_expiry=
|
|
661
|
+
max_keepalive_connections=getattr(self.config, "max_keepalive", 4),
|
|
662
|
+
keepalive_expiry=10,
|
|
663
663
|
)
|
|
664
664
|
ctx = ssl.create_default_context()
|
|
665
665
|
if not self.config.verify_ssl:
|
|
@@ -870,6 +870,12 @@ class BaseCore:
|
|
|
870
870
|
|
|
871
871
|
# 429: rate limited — respect Retry-After if present, else backoff and retry up to cap
|
|
872
872
|
if status == 429:
|
|
873
|
+
if attempt == 0 or attempt == 1:
|
|
874
|
+
self.logger.info("Trying 429 bypass (Initializing new session...)")
|
|
875
|
+
del self.session
|
|
876
|
+
self.initialize_session()
|
|
877
|
+
continue
|
|
878
|
+
|
|
873
879
|
wait = self._parse_retry_after(response)
|
|
874
880
|
if wait is None:
|
|
875
881
|
# fall back to exponential backoff proportional to attempt
|
|
@@ -1114,7 +1120,7 @@ class BaseCore:
|
|
|
1114
1120
|
return url, b"", False
|
|
1115
1121
|
|
|
1116
1122
|
def download(self, video, quality: str, downloader: str, path: str, callback=None, remux: bool = False,
|
|
1117
|
-
callback_remux=None) -> None:
|
|
1123
|
+
callback_remux=None, max_workers_download: int = 20) -> None:
|
|
1118
1124
|
"""
|
|
1119
1125
|
:param video:
|
|
1120
1126
|
:param callback:
|
|
@@ -1123,8 +1129,10 @@ class BaseCore:
|
|
|
1123
1129
|
:param path:
|
|
1124
1130
|
:param remux:
|
|
1125
1131
|
:param callback_remux:
|
|
1132
|
+
:param max_workers_download:
|
|
1126
1133
|
:return:
|
|
1127
1134
|
"""
|
|
1135
|
+
max_workers_download = max_workers_download or self.config.max_workers_download
|
|
1128
1136
|
|
|
1129
1137
|
if callback is None:
|
|
1130
1138
|
callback = Callback.text_progress_bar
|
|
@@ -1133,14 +1141,14 @@ class BaseCore:
|
|
|
1133
1141
|
self.default(video=video, quality=quality, path=path, callback=callback, remux=remux, callback_remux=callback_remux)
|
|
1134
1142
|
|
|
1135
1143
|
elif downloader == "threaded":
|
|
1136
|
-
threaded_download = self.threaded(max_workers=
|
|
1144
|
+
threaded_download = self.threaded(max_workers=max_workers_download, timeout=self.config.timeout)
|
|
1137
1145
|
threaded_download(self, video=video, quality=quality, path=path, callback=callback, remux=remux,
|
|
1138
1146
|
callback_remux=callback_remux)
|
|
1139
1147
|
|
|
1140
1148
|
elif downloader == "FFMPEG":
|
|
1141
1149
|
self.FFMPEG(video=video, quality=quality, path=path, callback=callback)
|
|
1142
1150
|
|
|
1143
|
-
def threaded(self, max_workers: int
|
|
1151
|
+
def threaded(self, max_workers: int, timeout: int):
|
|
1144
1152
|
def wrapper(self, video, quality: str, callback, path: str, remux: bool = True, callback_remux=None):
|
|
1145
1153
|
"""
|
|
1146
1154
|
This function has already been optimized a lot and is pretty much perfect in what's possible if we
|
|
@@ -12,6 +12,10 @@ class RuntimeConfig:
|
|
|
12
12
|
self.cookies = None
|
|
13
13
|
self.locale = "en-US,en;q=0.9" # If you override this, it could change regexes and thus make stuff not work...
|
|
14
14
|
self.use_http2 = True
|
|
15
|
+
self.max_workers_download = 20
|
|
16
|
+
self.videos_concurrency = 5
|
|
17
|
+
self.pages_concurrency = 2
|
|
18
|
+
|
|
15
19
|
|
|
16
20
|
# Singleton instance needed for my Porn Fetch project
|
|
17
21
|
config = RuntimeConfig()
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|