warp-beacon 2.6.7__py3-none-any.whl → 2.6.9__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.
@@ -1,2 +1,2 @@
1
- __version__ = "2.6.7"
1
+ __version__ = "2.6.9"
2
2
 
@@ -143,7 +143,7 @@ class YoutubeAbstract(ScraperAbstract):
143
143
  try:
144
144
  url = i.format(VIDEO_ID=video_id)
145
145
  logging.info("Youtube thumbnail url '%s'", url)
146
- with requests.get(url, timeout=(timeout, timeout)) as response:
146
+ with requests.get(url, timeout=(timeout, timeout), proxies=self.build_proxies(self.proxy.get("dsn", {}))) as response:
147
147
  if response.status_code == 200:
148
148
  image = Image.open(io.BytesIO(response.content))
149
149
  ratio = self.aspect_ratio(image.size)
@@ -228,6 +228,21 @@ class YoutubeAbstract(ScraperAbstract):
228
228
  pass
229
229
  #logging.info("bytes: %d, bytes remaining: %d", chunk, bytes_remaining)
230
230
 
231
+ def build_proxies(self, proxy_dsn: str) -> dict:
232
+ if not proxy_dsn:
233
+ logging.warning("Empty DSN!")
234
+ return {}
235
+ proxy = {}
236
+ if proxy_dsn:
237
+ if "https://" in proxy_dsn:
238
+ proxy["https"] = proxy_dsn
239
+ elif "http://" in proxy_dsn:
240
+ proxy["http"] = proxy_dsn
241
+ else:
242
+ logging.warning("Proxy DSN malformed!")
243
+
244
+ return proxy
245
+
231
246
  def build_yt(self, url: str, session: bool = True) -> YouTube:
232
247
  _default_clients["ANDROID"]["innertube_context"]["context"]["client"]["clientVersion"] = "19.08.35"
233
248
  _default_clients["ANDROID_MUSIC"] = _default_clients["ANDROID"]
@@ -253,12 +268,7 @@ class YoutubeAbstract(ScraperAbstract):
253
268
  proxy_dsn = self.proxy.get("dsn", "")
254
269
  logging.info("Using proxy DSN '%s'", proxy_dsn)
255
270
  if proxy_dsn:
256
- if "https://" in proxy_dsn:
257
- yt_opts["proxies"] = {"https": proxy_dsn}
258
- elif "http://" in proxy_dsn:
259
- yt_opts["proxies"] = {"http": proxy_dsn}
260
- else:
261
- logging.warning("Proxy DSN malformed!")
271
+ yt_opts["proxies"] = self.build_proxies(proxy_dsn)
262
272
  return YouTube(**yt_opts)
263
273
 
264
274
  def build_yt_dlp(self, timeout: int = 60) -> yt_dlp.YoutubeDL:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: warp_beacon
3
- Version: 2.6.7
3
+ Version: 2.6.9
4
4
  Summary: Telegram bot for expanding external media links
5
5
  Home-page: https://github.com/sb0y/warp_beacon
6
6
  Author: Andrey Bagrintsev
@@ -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=3O0Ft2ww0V89lSMfPFzcMeL9h_hTIKRTaAJtrfOb5VU,23
7
+ warp_beacon/__version__.py,sha256=_fL7hqsFpwtUso7ICu13IcK4s6swv1EFH-5JPOsOPhQ,23
8
8
  warp_beacon/warp_beacon.py,sha256=7KEtZDj-pdhtl6m-zFLsSojs1ZR4o7L0xbqtdmYPvfE,342
9
9
  warp_beacon/yt_auth.py,sha256=GUTKqYr_tzDC-07Lx_ahWXSag8EyLxXBUnQbDBIkEmk,6022
10
10
  warp_beacon/compress/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -32,7 +32,7 @@ warp_beacon/scraper/instagram/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5N
32
32
  warp_beacon/scraper/instagram/captcha.py,sha256=9UYziuqB3Tsat_ET6ex-cnZDbi6yCnsXHSpmE8MuUHk,4651
33
33
  warp_beacon/scraper/instagram/instagram.py,sha256=d3XSPkIYP5V1i7eTH0ZygOoN5f3GZRZVTNoLU7KC2JI,14641
34
34
  warp_beacon/scraper/youtube/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
- warp_beacon/scraper/youtube/abstract.py,sha256=HN6xpxxDo-LUYdtKeqNC0y07hnLi12ov7PQwnJ9aBFw,12199
35
+ warp_beacon/scraper/youtube/abstract.py,sha256=YuxGHgOtCp9gUHEO6wsHRtBO9cFz5A8RIW8sI0Kh5GY,12435
36
36
  warp_beacon/scraper/youtube/music.py,sha256=5AeSBQyUgVCJT2hoBCV2WvlyuV9US09SYJhmBG_P9F8,2755
37
37
  warp_beacon/scraper/youtube/shorts.py,sha256=1GtoYUlxAwcgSQcn80u5ehNJytH5AN5dPOicmX-XD8E,1705
38
38
  warp_beacon/scraper/youtube/youtube.py,sha256=ZjLv14l-ZeuJQXbZ88GbiXB276SmiGU3i8gUh6b-s60,5983
@@ -45,9 +45,9 @@ warp_beacon/telegram/handlers.py,sha256=uvR6TPHSqdSxigp3wR-ewiE6t3TvVcbVLVcYGwkg
45
45
  warp_beacon/telegram/placeholder_message.py,sha256=wN9-BRiyrtHG-EvXtZkGJHt2CX71munQ57ITttjt0mw,6400
46
46
  warp_beacon/telegram/utils.py,sha256=1Lq67aRylVJzbwSyvAgjPAGjJZFATkICvAj3TJGuJiM,4635
47
47
  warp_beacon/uploader/__init__.py,sha256=e75mOcC0vrUVjrTNMQzVUTgXGdGo4J6n8t5doOnYG5I,5616
48
- warp_beacon-2.6.7.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
49
- warp_beacon-2.6.7.dist-info/METADATA,sha256=9PhKeNYwVQJa27gxlMLnPAX0kqoSeHiatl59FFAZ8Bs,22705
50
- warp_beacon-2.6.7.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
51
- warp_beacon-2.6.7.dist-info/entry_points.txt,sha256=eSB61Rb89d56WY0O-vEIQwkn18J-4CMrJcLA_R_8h3g,119
52
- warp_beacon-2.6.7.dist-info/top_level.txt,sha256=4ML0-mXsezLtRXyxQUntL_ktc5HX9npTeQWzvV8kFvA,1161
53
- warp_beacon-2.6.7.dist-info/RECORD,,
48
+ warp_beacon-2.6.9.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
49
+ warp_beacon-2.6.9.dist-info/METADATA,sha256=6fxcEJIjqOn8oHEMOxRsq2fJ34Vgzp43wQg5_vqrFVI,22705
50
+ warp_beacon-2.6.9.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
51
+ warp_beacon-2.6.9.dist-info/entry_points.txt,sha256=eSB61Rb89d56WY0O-vEIQwkn18J-4CMrJcLA_R_8h3g,119
52
+ warp_beacon-2.6.9.dist-info/top_level.txt,sha256=4ML0-mXsezLtRXyxQUntL_ktc5HX9npTeQWzvV8kFvA,1161
53
+ warp_beacon-2.6.9.dist-info/RECORD,,