warp-beacon 2.6.71__py3-none-any.whl → 2.6.73__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.71"
1
+ __version__ = "2.6.73"
2
2
 
@@ -332,13 +332,13 @@ class InstagramScraper(ScraperAbstract):
332
332
  try:
333
333
  scrap_type, media_id = self.scrap(job.url)
334
334
  if scrap_type == "media":
335
- self.status_pipe.send({
336
- "action": "report_download_status",
337
- "report_type": ReportType.ANNOUNCE,
338
- "label": "Collecting meta information ...",
339
- "chat_id": self.job.chat_id,
340
- "message_id": self.job.placeholder_message_id
341
- })
335
+ #self.status_pipe.send({
336
+ # "action": "report_download_status",
337
+ # "report_type": ReportType.ANNOUNCE,
338
+ # "label": "Collecting meta information ...",
339
+ # "chat_id": self.job.chat_id,
340
+ # "message_id": self.job.placeholder_message_id
341
+ #})
342
342
  media_info = self.download_hndlr(self.cl.media_info_v1, media_id)
343
343
  logging.info("media_type is '%d', product_type is '%s'", media_info.media_type, media_info.product_type)
344
344
  if media_info.media_type == 2 and media_info.product_type == "clips": # Reels
@@ -432,7 +432,7 @@ class InstagramScraper(ScraperAbstract):
432
432
 
433
433
  def download_progress(self, total: int | None, bytes_transferred: int, path: Path) -> None:
434
434
  percentage_of_completion = round(bytes_transferred / (total or 1) * 100)
435
- if total == 0 or percentage_of_completion >= self._download_progress_threshold:
435
+ if percentage_of_completion >= self._download_progress_threshold:
436
436
  logging.debug("[Download] IG file '%s', %d", str(path), percentage_of_completion)
437
437
  msg = {
438
438
  "action": "report_download_status",
@@ -35,7 +35,6 @@ class WBClient(Client):
35
35
  content_length = int(response.headers.get("Content-Length", 0))
36
36
  except (TypeError, ValueError):
37
37
  logging.warning("Content-Length header is missing or invalid.")
38
- content_length = 0
39
38
 
40
39
  downloaded = 0
41
40
  with open(path, "wb") as f:
@@ -59,4 +58,37 @@ class WBClient(Client):
59
58
  f'Broken file "{path}" (expected {content_length}, got {downloaded})'
60
59
  )
61
60
 
61
+ return path.resolve()
62
+
63
+ def photo_download_by_url(
64
+ self, url: str, filename: str = "", folder: Path = ""
65
+ ) -> Path:
66
+ fname = urlparse(url).path.rsplit("/", 1)[1]
67
+ filename = f"{filename}.{(filename, fname.rsplit('.', 1)[1]) if filename else fname}"
68
+ path = Path(folder) / filename
69
+ response = requests.get(url, stream=True, timeout=self.request_timeout)
70
+ response.raise_for_status()
71
+
72
+ content_length = 0
73
+ try:
74
+ content_length = int(response.headers.get("Content-Length", 0))
75
+ except (TypeError, ValueError):
76
+ logging.warning("Content-Length header is missing or invalid.")
77
+
78
+ downloaded = 0
79
+ with open(path, "wb") as f:
80
+ response.raw.decode_content = True
81
+ for chunk in response.iter_content(chunk_size=4096):
82
+ if chunk:
83
+ f.write(chunk)
84
+ downloaded += len(chunk)
85
+ if self.progress_callback:
86
+ try:
87
+ self.progress_callback(
88
+ total=content_length or None,
89
+ bytes_transferred=downloaded,
90
+ path=path
91
+ )
92
+ except Exception as e:
93
+ logging.warning("Progress callback raised an exception!", exc_info=e)
62
94
  return path.resolve()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: warp_beacon
3
- Version: 2.6.71
3
+ Version: 2.6.73
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=uGt3g_P9WpNr2EbbSgiCpFoZBN4pgUob2az4Jfl2tIE,24
7
+ warp_beacon/__version__.py,sha256=pcqEX20h5-OvfcFaXCw9T_RvxXbCfPLtg2HQoD0TDBI,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
@@ -31,8 +31,8 @@ warp_beacon/scraper/link_resolver.py,sha256=Rc9ZuMyOo3iPywDHwjngy-WRQ2SXhJwxcg-5
31
31
  warp_beacon/scraper/utils.py,sha256=xJfCVhiLjVPoFVupE10sTzX7UpgNWbx2EeYIsoYXGDk,43
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
- warp_beacon/scraper/instagram/instagram.py,sha256=2LfBmVdClSp1AdbJFGu_9CYjVeErGdurUvpz0JhAngk,17160
35
- warp_beacon/scraper/instagram/wb_instagrapi.py,sha256=oN8re-17F43TEf6hdu8wC5QGUCiTsTFpdifvZwx3w7o,1854
34
+ warp_beacon/scraper/instagram/instagram.py,sha256=c_7E0z1m728n9hOqWR3SXbGLW61a_wxG-GZsoue64tM,17153
35
+ warp_beacon/scraper/instagram/wb_instagrapi.py,sha256=1YMU6_PUa4g6usKU1EQPaWVw3c3ljxgoSh8BuhI8bsg,2911
36
36
  warp_beacon/scraper/youtube/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
37
  warp_beacon/scraper/youtube/abstract.py,sha256=sU1inNjg0dv96ae8pZennYfczE4u227RcpgulOtTNLw,13132
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.71.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
56
- warp_beacon-2.6.71.dist-info/METADATA,sha256=8Z1QMYMn_-QEZYJvAu7PRVwwqFWxiSR3gjJ-hmZGW6E,22706
57
- warp_beacon-2.6.71.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
58
- warp_beacon-2.6.71.dist-info/entry_points.txt,sha256=eSB61Rb89d56WY0O-vEIQwkn18J-4CMrJcLA_R_8h3g,119
59
- warp_beacon-2.6.71.dist-info/top_level.txt,sha256=5YQRN46STNg81V_3jdzZ6bftkMxhe1hTPSFvJugDu84,1405
60
- warp_beacon-2.6.71.dist-info/RECORD,,
55
+ warp_beacon-2.6.73.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
56
+ warp_beacon-2.6.73.dist-info/METADATA,sha256=R8mOW5t3RDBo1pFPLHjZmuHpaaTcv_4NooU2gCGPRps,22706
57
+ warp_beacon-2.6.73.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
58
+ warp_beacon-2.6.73.dist-info/entry_points.txt,sha256=eSB61Rb89d56WY0O-vEIQwkn18J-4CMrJcLA_R_8h3g,119
59
+ warp_beacon-2.6.73.dist-info/top_level.txt,sha256=5YQRN46STNg81V_3jdzZ6bftkMxhe1hTPSFvJugDu84,1405
60
+ warp_beacon-2.6.73.dist-info/RECORD,,