warp-beacon 2.3.35__tar.gz → 2.3.37__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.
- {warp_beacon-2.3.35/warp_beacon.egg-info → warp_beacon-2.3.37}/PKG-INFO +1 -1
- warp_beacon-2.3.37/warp_beacon/__version__.py +2 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon/scraper/youtube/abstract.py +31 -17
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon/scraper/youtube/youtube.py +2 -2
- {warp_beacon-2.3.35 → warp_beacon-2.3.37/warp_beacon.egg-info}/PKG-INFO +1 -1
- warp_beacon-2.3.35/warp_beacon/__version__.py +0 -2
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/LICENSE +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/MANIFEST.in +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/README.md +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/assets/placeholder.gif +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/etc/.gitignore +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/etc/accounts.json +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/etc/proxies.json +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/etc/warp_beacon.conf +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/etc/warp_beacon.service +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/pyproject.toml +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/setup.cfg +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/setup.py +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon/__init__.py +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon/compress/__init__.py +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon/compress/video.py +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon/jobs/__init__.py +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon/jobs/abstract.py +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon/jobs/download_job.py +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon/jobs/types.py +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon/jobs/upload_job.py +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon/mediainfo/__init__.py +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon/mediainfo/abstract.py +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon/mediainfo/audio.py +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon/mediainfo/silencer.py +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon/mediainfo/video.py +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon/scheduler/__init__.py +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon/scheduler/instagram_human.py +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon/scheduler/scheduler.py +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon/scraper/__init__.py +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon/scraper/abstract.py +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon/scraper/account_selector.py +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon/scraper/exceptions.py +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon/scraper/fail_handler.py +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon/scraper/instagram/__init__.py +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon/scraper/instagram/instagram.py +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon/scraper/link_resolver.py +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon/scraper/youtube/__init__.py +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon/scraper/youtube/music.py +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon/scraper/youtube/shorts.py +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon/storage/__init__.py +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon/storage/mongo.py +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon/telegram/__init__.py +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon/telegram/bot.py +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon/telegram/caption_shortener.py +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon/telegram/handlers.py +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon/telegram/placeholder_message.py +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon/telegram/utils.py +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon/uploader/__init__.py +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon/warp_beacon.py +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon.egg-info/SOURCES.txt +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon.egg-info/dependency_links.txt +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon.egg-info/entry_points.txt +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon.egg-info/requires.txt +0 -0
- {warp_beacon-2.3.35 → warp_beacon-2.3.37}/warp_beacon.egg-info/top_level.txt +0 -0
@@ -1,4 +1,5 @@
|
|
1
|
-
import os
|
1
|
+
import os
|
2
|
+
import io
|
2
3
|
import pathlib
|
3
4
|
import time
|
4
5
|
import math
|
@@ -8,8 +9,8 @@ import ssl
|
|
8
9
|
from typing import Callable, Union, Optional
|
9
10
|
import json
|
10
11
|
import urllib
|
11
|
-
import requests
|
12
12
|
import http.client
|
13
|
+
import requests
|
13
14
|
from PIL import Image
|
14
15
|
import numpy as np
|
15
16
|
|
@@ -181,8 +182,8 @@ class YoutubeAbstract(ScraperAbstract):
|
|
181
182
|
|
182
183
|
return None
|
183
184
|
|
184
|
-
def download_hndlr(self, func: Callable, *args: tuple[Union[str, int, dict, tuple]], **kwargs: dict[Union[str, int, dict, tuple]]) -> Union[
|
185
|
-
ret_val =
|
185
|
+
def download_hndlr(self, func: Callable, *args: tuple[Union[str, int, dict, tuple, bool]], **kwargs: dict[Union[str, int, dict, tuple, bool]]) -> Optional[Union[list, dict, str, io.BytesIO]]:
|
186
|
+
ret_val = None
|
186
187
|
max_retries = int(os.environ.get("YT_MAX_RETRIES", default=self.YT_MAX_RETRIES_DEFAULT))
|
187
188
|
pause_secs = int(os.environ.get("YT_PAUSE_BEFORE_RETRY", default=self.YT_PAUSE_BEFORE_RETRY_DEFAULT))
|
188
189
|
timeout = int(os.environ.get("YT_TIMEOUT", default=self.YT_TIMEOUT_DEFAULT))
|
@@ -224,27 +225,40 @@ class YoutubeAbstract(ScraperAbstract):
|
|
224
225
|
pass
|
225
226
|
#logging.info("bytes: %d, bytes remaining: %d", chunk, bytes_remaining)
|
226
227
|
|
227
|
-
def build_yt(self, url: str) -> YouTube:
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
228
|
+
def build_yt(self, url: str, session: bool = True) -> YouTube:
|
229
|
+
if session:
|
230
|
+
InnerTube.send_message_to_admin_func = self.send_message_to_admin_func
|
231
|
+
InnerTube.auth_event = self.auth_event
|
232
|
+
InnerTube.wb_account = self.account
|
233
|
+
InnerTube.fetch_bearer_token = patched_fetch_bearer_token
|
232
234
|
_default_clients["ANDROID"]["innertube_context"]["context"]["client"]["clientVersion"] = "19.08.35"
|
233
235
|
_default_clients["ANDROID_MUSIC"] = _default_clients["ANDROID"]
|
234
236
|
yt_opts = {"url": url, "on_progress_callback": self.yt_on_progress}
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
237
|
+
if session:
|
238
|
+
yt_opts["client"] = "TV_EMBED"
|
239
|
+
yt_opts["use_oauth"] = True
|
240
|
+
yt_opts["allow_oauth_cache"] = True
|
241
|
+
yt_opts["token_file"] = self.YT_SESSION_FILE % self.account_index
|
239
242
|
if self.proxy:
|
240
243
|
proxy_dsn = self.proxy.get("dsn", "")
|
241
244
|
if proxy_dsn:
|
242
245
|
logging.info("Using proxy DSN '%s'", proxy_dsn)
|
243
|
-
|
246
|
+
if "https://" in proxy_dsn:
|
247
|
+
yt_opts["proxies"] = {"https": proxy_dsn}
|
248
|
+
elif "http://" in proxy_dsn:
|
249
|
+
yt_opts["proxies"] = {"http": proxy_dsn}
|
250
|
+
else:
|
251
|
+
logging.warning("Proxy DSN malformed!")
|
244
252
|
return YouTube(**yt_opts)
|
245
253
|
|
246
|
-
def _download(self,
|
247
|
-
raise NotImplementedError("
|
254
|
+
def _download(self, _: str) -> list:
|
255
|
+
raise NotImplementedError("You should to implement _download method")
|
248
256
|
|
249
257
|
def download(self, job: DownloadJob) -> list:
|
250
|
-
|
258
|
+
try:
|
259
|
+
return self.download_hndlr(self._download, job.url, session=False)
|
260
|
+
except Unavailable:
|
261
|
+
logging.warning("Failed sessionless download attempt. Trying with session.")
|
262
|
+
time.sleep(2)
|
263
|
+
|
264
|
+
return self.download_hndlr(self._download, job.url, session=True)
|
@@ -28,11 +28,11 @@ class YoutubeScraper(YoutubeAbstract):
|
|
28
28
|
|
29
29
|
return False
|
30
30
|
|
31
|
-
def _download(self, url: str, timeout: int = 0) -> list:
|
31
|
+
def _download(self, url: str, session: bool = True, timeout: int = 0) -> list:
|
32
32
|
res = []
|
33
33
|
try:
|
34
34
|
thumbnail = None
|
35
|
-
yt = self.build_yt(url)
|
35
|
+
yt = self.build_yt(url, session=session)
|
36
36
|
|
37
37
|
if self.is_live(yt.initial_data):
|
38
38
|
raise YoutubeLiveError("Youtube Live is not supported")
|
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
|
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
|
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
|
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|