warp-beacon 2.3.36__py3-none-any.whl → 2.3.37__py3-none-any.whl
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/__version__.py +1 -1
- warp_beacon/scraper/youtube/abstract.py +23 -14
- warp_beacon/scraper/youtube/youtube.py +2 -2
- {warp_beacon-2.3.36.dist-info → warp_beacon-2.3.37.dist-info}/METADATA +1 -1
- {warp_beacon-2.3.36.dist-info → warp_beacon-2.3.37.dist-info}/RECORD +9 -9
- {warp_beacon-2.3.36.dist-info → warp_beacon-2.3.37.dist-info}/LICENSE +0 -0
- {warp_beacon-2.3.36.dist-info → warp_beacon-2.3.37.dist-info}/WHEEL +0 -0
- {warp_beacon-2.3.36.dist-info → warp_beacon-2.3.37.dist-info}/entry_points.txt +0 -0
- {warp_beacon-2.3.36.dist-info → warp_beacon-2.3.37.dist-info}/top_level.txt +0 -0
warp_beacon/__version__.py
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
__version__ = "2.3.
|
1
|
+
__version__ = "2.3.37"
|
2
2
|
|
@@ -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,18 +225,20 @@ 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:
|
@@ -252,4 +255,10 @@ class YoutubeAbstract(ScraperAbstract):
|
|
252
255
|
raise NotImplementedError("You should to implement _download method")
|
253
256
|
|
254
257
|
def download(self, job: DownloadJob) -> list:
|
255
|
-
|
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")
|
@@ -4,7 +4,7 @@ var/warp_beacon/accounts.json,sha256=OsXdncs6h88xrF_AP6_WDCK1waGBn9SR-uYdIeK37GM
|
|
4
4
|
var/warp_beacon/placeholder.gif,sha256=cE5CGJVaop4Sx21zx6j4AyoHU0ncmvQuS2o6hJfEH88,6064
|
5
5
|
var/warp_beacon/proxies.json,sha256=VnjlQDXumOEq72ZFjbh6IqHS1TEHqn8HPYAZqWCeSIA,95
|
6
6
|
warp_beacon/__init__.py,sha256=_rThNODmz0nDp_n4mWo_HKaNFE5jk1_7cRhHyYaencI,163
|
7
|
-
warp_beacon/__version__.py,sha256=
|
7
|
+
warp_beacon/__version__.py,sha256=em1BRpHTMnXVWmKRYuPX7Rf70u-Vdq382cwNLNQV7lc,24
|
8
8
|
warp_beacon/warp_beacon.py,sha256=7KEtZDj-pdhtl6m-zFLsSojs1ZR4o7L0xbqtdmYPvfE,342
|
9
9
|
warp_beacon/compress/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
10
|
warp_beacon/compress/video.py,sha256=_PDMVYCyzLYxHv1uZmmzGcG_8rjaZr7BTXsXTTy_oS4,2846
|
@@ -30,10 +30,10 @@ warp_beacon/scraper/link_resolver.py,sha256=Rc9ZuMyOo3iPywDHwjngy-WRQ2SXhJwxcg-5
|
|
30
30
|
warp_beacon/scraper/instagram/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
31
31
|
warp_beacon/scraper/instagram/instagram.py,sha256=TpIBS9S3zcLbeGax4CENVo6WP75EE6oIttc-MjWYVjs,13815
|
32
32
|
warp_beacon/scraper/youtube/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
33
|
-
warp_beacon/scraper/youtube/abstract.py,sha256=
|
33
|
+
warp_beacon/scraper/youtube/abstract.py,sha256=HnjSTGumo4uzxEZydH18zhsqMrus38Vx3SRGhuuXl0c,9707
|
34
34
|
warp_beacon/scraper/youtube/music.py,sha256=MObH7rU6qmg6xG3rRkO4iqmhm8uF4UlF2OqfF4G1eec,1379
|
35
35
|
warp_beacon/scraper/youtube/shorts.py,sha256=Ij4IVCOfYGHvmbRbrE4Zli0GiHlM4qhd9wiUzr6qeUE,1230
|
36
|
-
warp_beacon/scraper/youtube/youtube.py,sha256=
|
36
|
+
warp_beacon/scraper/youtube/youtube.py,sha256=TH5od6UPh1lAzDU_UC9Y5uQ-O8scLfk6OWWKWLF6LDo,2173
|
37
37
|
warp_beacon/storage/__init__.py,sha256=0Vajd0oITKJfu2vmNx5uQSt3-L6vwIvUYWJo8HZCjco,3398
|
38
38
|
warp_beacon/storage/mongo.py,sha256=qC4ZiO8XXvPnP0rJwz4CJx42pqFsyAjCiW10W5QdT6E,527
|
39
39
|
warp_beacon/telegram/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -43,9 +43,9 @@ warp_beacon/telegram/handlers.py,sha256=XXIfdV_RCj7tyZMPXchuKmGoDdweOaR08ADDaBPW
|
|
43
43
|
warp_beacon/telegram/placeholder_message.py,sha256=wN9-BRiyrtHG-EvXtZkGJHt2CX71munQ57ITttjt0mw,6400
|
44
44
|
warp_beacon/telegram/utils.py,sha256=9uebX53G16mV7ER7WgfdWBLFHHw14S8HBt9URrIskg0,4440
|
45
45
|
warp_beacon/uploader/__init__.py,sha256=E9rlZIf7xlQz6MutMOwJ8S5Vm2uheR5nv23Kv8duRQg,5427
|
46
|
-
warp_beacon-2.3.
|
47
|
-
warp_beacon-2.3.
|
48
|
-
warp_beacon-2.3.
|
49
|
-
warp_beacon-2.3.
|
50
|
-
warp_beacon-2.3.
|
51
|
-
warp_beacon-2.3.
|
46
|
+
warp_beacon-2.3.37.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
47
|
+
warp_beacon-2.3.37.dist-info/METADATA,sha256=8HEZ5LA7a5DEqOq_EOfbx8XwmQrxMdDUv-5fHkarBdE,21723
|
48
|
+
warp_beacon-2.3.37.dist-info/WHEEL,sha256=beeZ86-EfXScwlR_HKu4SllMC9wUEj_8Z_4FJ3egI2w,91
|
49
|
+
warp_beacon-2.3.37.dist-info/entry_points.txt,sha256=eSB61Rb89d56WY0O-vEIQwkn18J-4CMrJcLA_R_8h3g,119
|
50
|
+
warp_beacon-2.3.37.dist-info/top_level.txt,sha256=qGjHVVfyf6lTmbdSA-fQq0rHS1YVS4HoJT3rag5xgPE,1141
|
51
|
+
warp_beacon-2.3.37.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|