warp-beacon 2.6.81__py3-none-any.whl → 2.6.82__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.81"
1
+ __version__ = "2.6.82"
2
2
 
@@ -1,6 +1,6 @@
1
1
  import logging
2
2
  from typing import Callable
3
- from urllib.parse import urlparse
3
+ from urllib.parse import urlparse, parse_qs, urlencode, urlunparse
4
4
  from pathlib import Path
5
5
  import requests
6
6
 
@@ -36,13 +36,22 @@ class WBClient(Client):
36
36
  "Upgrade-Insecure-Requests": "1",
37
37
  "DNT": "1",
38
38
  })
39
+ self.essential_params = {"oe", "oh", "_nc_ht", "_nc_cat", "_nc_oc", "_nc_ohc", "_nc_gid"}
39
40
 
40
41
  def set_progress_callback(self, callback: Callable[[int | None, int, Path], None]) -> None:
41
42
  if not callback or not callable(callback):
42
43
  raise TypeError("Progress callback must be callable")
43
44
  self.progress_callback = callback
44
45
 
46
+ def sanitize_instagram_url(self, url: str) -> str:
47
+ parsed = urlparse(url)
48
+ query = parse_qs(parsed.query)
49
+ filtered_query = {k: v for k, v in query.items() if k in self.essential_params}
50
+ new_query = urlencode(filtered_query, doseq=True)
51
+ return urlunparse(parsed._replace(query=new_query))
52
+
45
53
  def video_download_by_url(self, url: str, filename: str = "", folder: Path = "") -> Path:
54
+ url = self.sanitize_instagram_url(url)
46
55
  fname = urlparse(url).path.rsplit("/", 1)[1]
47
56
  filename = f"{filename}.{fname.rsplit('.', 1)[1]}" if filename else fname
48
57
  path = Path(folder or Path.cwd()) / filename
@@ -94,6 +103,7 @@ class WBClient(Client):
94
103
  def photo_download_by_url(
95
104
  self, url: str, filename: str = "", folder: Path = ""
96
105
  ) -> Path:
106
+ url = self.sanitize_instagram_url(url)
97
107
  fname = urlparse(url).path.rsplit("/", 1)[1]
98
108
  filename = f"{filename}.{(filename, fname.rsplit('.', 1)[1]) if filename else fname}"
99
109
  path = Path(folder) / filename
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: warp_beacon
3
- Version: 2.6.81
3
+ Version: 2.6.82
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=ZFc8LcoqLT957m_J02UFSecV7Rp6MYYc1odhA3gNNHo,24
7
+ warp_beacon/__version__.py,sha256=nX1HTS4zhGP6XRS5AnrBku-hDOjJ2Xz_qNLtH0Nr9_M,24
8
8
  warp_beacon/warp_beacon.py,sha256=ED43vNzdjDUJ_9qLCbri0bjWLWEJ69BENGj9i7G6AvM,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/utils.py,sha256=xJfCVhiLjVPoFVupE10sTzX7UpgNWbx2EeYIsoYXGDk,
32
32
  warp_beacon/scraper/instagram/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
33
  warp_beacon/scraper/instagram/captcha.py,sha256=9UYziuqB3Tsat_ET6ex-cnZDbi6yCnsXHSpmE8MuUHk,4651
34
34
  warp_beacon/scraper/instagram/instagram.py,sha256=3KhxVQSL3lzovu9hjMA83sCv87u4TTDMfDQrxogoWak,17179
35
- warp_beacon/scraper/instagram/wb_instagrapi.py,sha256=LCIHkLm8w6cc4_RNPcpGUooP4tJEbSffHic6kIehhy4,4416
35
+ warp_beacon/scraper/instagram/wb_instagrapi.py,sha256=E1toUKuprUXrHYtnZAb2nK5VnGbW0P_ZHlnp_V95oNo,4922
36
36
  warp_beacon/scraper/youtube/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
37
  warp_beacon/scraper/youtube/abstract.py,sha256=K2ovycq1lkx0a2R1FddO3B0IcaVsVzni_fdXzajGdwg,13134
38
38
  warp_beacon/scraper/youtube/music.py,sha256=5AeSBQyUgVCJT2hoBCV2WvlyuV9US09SYJhmBG_P9F8,2755
@@ -52,9 +52,9 @@ warp_beacon/telegram/progress_file_reader.py,sha256=e3equyNKlKs764AD-iE9QRsh3YDH
52
52
  warp_beacon/telegram/types.py,sha256=Kvdng6uCF1HRoqQgGW1ZYYPJoVuYkFb-LDvMBbW5Hjk,89
53
53
  warp_beacon/telegram/utils.py,sha256=1Lq67aRylVJzbwSyvAgjPAGjJZFATkICvAj3TJGuJiM,4635
54
54
  warp_beacon/uploader/__init__.py,sha256=j3qcuKhpchseZLGzSsSiogqe6WdMbkK8d3I-ConhNRs,5687
55
- warp_beacon-2.6.81.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
56
- warp_beacon-2.6.81.dist-info/METADATA,sha256=2IjtZzvVVC1hSJKpE4nNeZxLzcHXIzVgvEctHklZJm8,22706
57
- warp_beacon-2.6.81.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
58
- warp_beacon-2.6.81.dist-info/entry_points.txt,sha256=eSB61Rb89d56WY0O-vEIQwkn18J-4CMrJcLA_R_8h3g,119
59
- warp_beacon-2.6.81.dist-info/top_level.txt,sha256=5YQRN46STNg81V_3jdzZ6bftkMxhe1hTPSFvJugDu84,1405
60
- warp_beacon-2.6.81.dist-info/RECORD,,
55
+ warp_beacon-2.6.82.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
56
+ warp_beacon-2.6.82.dist-info/METADATA,sha256=l1oynk7459iL3wAOoGgKVF8wEi8kDWwyraVOlAaJBVA,22706
57
+ warp_beacon-2.6.82.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
58
+ warp_beacon-2.6.82.dist-info/entry_points.txt,sha256=eSB61Rb89d56WY0O-vEIQwkn18J-4CMrJcLA_R_8h3g,119
59
+ warp_beacon-2.6.82.dist-info/top_level.txt,sha256=5YQRN46STNg81V_3jdzZ6bftkMxhe1hTPSFvJugDu84,1405
60
+ warp_beacon-2.6.82.dist-info/RECORD,,