warp-beacon 2.6.76__tar.gz → 2.6.78__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.
Files changed (69) hide show
  1. {warp_beacon-2.6.76/warp_beacon.egg-info → warp_beacon-2.6.78}/PKG-INFO +1 -1
  2. warp_beacon-2.6.78/warp_beacon/__version__.py +2 -0
  3. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/scraper/instagram/instagram.py +2 -0
  4. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/scraper/instagram/wb_instagrapi.py +6 -1
  5. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/telegram/edit_message.py +22 -18
  6. {warp_beacon-2.6.76 → warp_beacon-2.6.78/warp_beacon.egg-info}/PKG-INFO +1 -1
  7. warp_beacon-2.6.76/warp_beacon/__version__.py +0 -2
  8. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/LICENSE +0 -0
  9. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/MANIFEST.in +0 -0
  10. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/README.md +0 -0
  11. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/assets/placeholder.gif +0 -0
  12. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/etc/.gitignore +0 -0
  13. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/etc/accounts.json +0 -0
  14. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/etc/proxies.json +0 -0
  15. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/etc/warp_beacon.conf +0 -0
  16. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/etc/warp_beacon.service +0 -0
  17. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/pyproject.toml +0 -0
  18. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/setup.cfg +0 -0
  19. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/setup.py +0 -0
  20. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/__init__.py +0 -0
  21. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/compress/__init__.py +0 -0
  22. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/compress/video.py +0 -0
  23. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/jobs/__init__.py +0 -0
  24. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/jobs/abstract.py +0 -0
  25. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/jobs/download_job.py +0 -0
  26. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/jobs/types.py +0 -0
  27. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/jobs/upload_job.py +0 -0
  28. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/mediainfo/__init__.py +0 -0
  29. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/mediainfo/abstract.py +0 -0
  30. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/mediainfo/audio.py +0 -0
  31. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/mediainfo/silencer.py +0 -0
  32. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/mediainfo/video.py +0 -0
  33. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/scheduler/__init__.py +0 -0
  34. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/scheduler/instagram_human.py +0 -0
  35. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/scheduler/scheduler.py +0 -0
  36. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/scraper/__init__.py +0 -0
  37. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/scraper/abstract.py +0 -0
  38. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/scraper/account_selector.py +0 -0
  39. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/scraper/exceptions.py +0 -0
  40. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/scraper/fail_handler.py +0 -0
  41. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/scraper/instagram/__init__.py +0 -0
  42. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/scraper/instagram/captcha.py +0 -0
  43. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/scraper/link_resolver.py +0 -0
  44. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/scraper/utils.py +0 -0
  45. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/scraper/youtube/__init__.py +0 -0
  46. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/scraper/youtube/abstract.py +0 -0
  47. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/scraper/youtube/music.py +0 -0
  48. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/scraper/youtube/shorts.py +0 -0
  49. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/scraper/youtube/youtube.py +0 -0
  50. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/storage/__init__.py +0 -0
  51. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/storage/mongo.py +0 -0
  52. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/telegram/__init__.py +0 -0
  53. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/telegram/bot.py +0 -0
  54. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/telegram/caption_shortener.py +0 -0
  55. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/telegram/download_status.py +0 -0
  56. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/telegram/handlers.py +0 -0
  57. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/telegram/placeholder_message.py +0 -0
  58. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/telegram/progress_bar.py +0 -0
  59. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/telegram/progress_file_reader.py +0 -0
  60. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/telegram/types.py +0 -0
  61. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/telegram/utils.py +0 -0
  62. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/uploader/__init__.py +0 -0
  63. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/warp_beacon.py +0 -0
  64. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon/yt_auth.py +0 -0
  65. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon.egg-info/SOURCES.txt +0 -0
  66. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon.egg-info/dependency_links.txt +0 -0
  67. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon.egg-info/entry_points.txt +0 -0
  68. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon.egg-info/requires.txt +0 -0
  69. {warp_beacon-2.6.76 → warp_beacon-2.6.78}/warp_beacon.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: warp_beacon
3
- Version: 2.6.76
3
+ Version: 2.6.78
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
@@ -0,0 +1,2 @@
1
+ __version__ = "2.6.78"
2
+
@@ -431,6 +431,8 @@ class InstagramScraper(ScraperAbstract):
431
431
  return password
432
432
 
433
433
  def download_progress(self, total: int | None, bytes_transferred: int, path: Path) -> None:
434
+ if not total:
435
+ return
434
436
  percentage_of_completion = round(bytes_transferred / (total or 1) * 100)
435
437
  if percentage_of_completion >= self._download_progress_threshold:
436
438
  logging.debug("[Download] IG file '%s', %d", str(path), percentage_of_completion)
@@ -25,10 +25,11 @@ class WBClient(Client):
25
25
  filename = f"{filename}.{fname.rsplit('.', 1)[1]}" if filename else fname
26
26
  path = Path(folder or Path.cwd()) / filename
27
27
 
28
- logging.info("Downloading video from %s to %s", url, path)
28
+ logging.info("Downloading video from '%s' to '%s'", url, path)
29
29
 
30
30
  response = requests.get(url, stream=True, timeout=self.request_timeout)
31
31
  response.raise_for_status()
32
+ logging.info("Response headers: %s", response.headers)
32
33
 
33
34
  content_length = 0
34
35
  try:
@@ -66,8 +67,12 @@ class WBClient(Client):
66
67
  fname = urlparse(url).path.rsplit("/", 1)[1]
67
68
  filename = f"{filename}.{(filename, fname.rsplit('.', 1)[1]) if filename else fname}"
68
69
  path = Path(folder) / filename
70
+
71
+ logging.info("Downloading photo from '%s' to '%s'", url, path)
72
+
69
73
  response = requests.get(url, stream=True, timeout=self.request_timeout)
70
74
  response.raise_for_status()
75
+ logging.info("Response headers: %s", response.headers)
71
76
 
72
77
  content_length = 0
73
78
  try:
@@ -1,3 +1,5 @@
1
+ import re
2
+
1
3
  from pyrogram.client import Client
2
4
  from pyrogram.types import InputMedia, InputMediaAudio, InputMediaPhoto, InputMediaVideo, InputMediaAnimation, InlineKeyboardMarkup
3
5
  from pyrogram import raw
@@ -9,6 +11,7 @@ from warp_beacon.telegram.types import ReportType
9
11
  class EditMessage(object):
10
12
  def __init__(self, client: Client) -> None:
11
13
  self.client = client
14
+ self.base64_str_tpl = re.compile(r"[A-Za-z0-9\-_]{30,}")
12
15
 
13
16
  def get_wrapped_video(self, raw_file: raw.base.InputFile, raw_thumb: raw.base.InputFile, media: InputMediaVideo, file_name: str = None) -> raw.types.InputMediaUploadedDocument:
14
17
  return raw.types.InputMediaUploadedDocument(
@@ -72,18 +75,8 @@ class EditMessage(object):
72
75
  ]
73
76
  )
74
77
 
75
- #async def upload_with_progress(self,
76
- # media: InputMedia | InputMediaAudio | InputMediaPhoto | InputMediaVideo | InputMediaAnimation,
77
- # chat_id: int | str,
78
- # message_id: int,
79
- # file_name: str
80
- #) -> raw.base.InputFile:
81
- # progress_bar = ProgressBar(self.client)
82
- # progress_id = f"{chat_id}:{message_id}:{file_name}"
83
- # self.progress_bars[progress_id] = progress_bar
84
- # raw_file = await self.client.save_file(path=media.media, progress=progress_bar.progress_callback, progress_args=(chat_id, message_id, file_name,))
85
- # del self.progress_bars[progress_id]
86
- # return raw_file
78
+ def looks_like_token(self, s: str) -> bool:
79
+ return bool(self.base64_str_tpl, s)
87
80
 
88
81
  async def edit(self,
89
82
  chat_id: int | str,
@@ -92,9 +85,14 @@ class EditMessage(object):
92
85
  reply_markup: InlineKeyboardMarkup = None,
93
86
  file_name: str = None
94
87
  ) -> None:
95
- progress_bar = ProgressBar(self.client)
96
- #await progress_bar.progress_callback(current=0, total=0, chat_id=chat_id, message_id=message_id, operation="Uploading", label=file_name, report_type=ReportType.PROGRESS)
97
- raw_file = await self.client.save_file(path=media.media, progress=progress_bar.progress_callback, progress_args=(chat_id, message_id, "Uploading", ReportType.PROGRESS, file_name))
88
+ is_looks_like_token = self.looks_like_token(media.media)
89
+ raw_file = None
90
+ if not is_looks_like_token:
91
+ progress_bar = ProgressBar(self.client)
92
+ #await progress_bar.progress_callback(current=0, total=0, chat_id=chat_id, message_id=message_id, operation="Uploading", label=file_name, report_type=ReportType.PROGRESS)
93
+ raw_file = await self.client.save_file(path=media.media, progress=progress_bar.progress_callback, progress_args=(chat_id, message_id, "Uploading", ReportType.PROGRESS, file_name))
94
+ else:
95
+ raw_file = media.media
98
96
 
99
97
  caption = media.caption
100
98
  parse_mode = media.parse_mode
@@ -107,17 +105,23 @@ class EditMessage(object):
107
105
  raw_media = None
108
106
  if isinstance(media, types.InputMediaVideo):
109
107
  #progress_bar_thumb = ProgressBar(self.client)
110
- raw_file_thumb = await self.client.save_file(path=media.thumb)
108
+ raw_file_thumb = None
109
+ if not is_looks_like_token:
110
+ raw_file_thumb = await self.client.save_file(path=media.thumb)
111
111
  raw_media = self.get_wrapped_video(raw_file=raw_file, raw_thumb=raw_file_thumb, media=media, file_name=file_name)
112
112
  elif isinstance(media, types.InputMediaPhoto):
113
113
  raw_media = self.get_wrapped_photo(raw_file=raw_file, media=media)
114
114
  elif isinstance(media, types.InputMediaAudio):
115
115
  #progress_bar_thumb = ProgressBar(self.client)
116
- raw_file_thumb = await self.client.save_file(path=media.thumb)
116
+ raw_file_thumb = None
117
+ if not is_looks_like_token:
118
+ raw_file_thumb = await self.client.save_file(path=media.thumb)
117
119
  raw_media = self.get_wrapped_audio(raw_file=raw_file, raw_thumb=raw_file_thumb, media=media, file_name=file_name)
118
120
  elif isinstance(media, types.InputMediaAnimation):
119
121
  #progress_bar_thumb = ProgressBar(self.client)
120
- raw_file_thumb = await self.client.save_file(path=media.thumb)
122
+ raw_file_thumb = None
123
+ if not is_looks_like_token:
124
+ raw_file_thumb = await self.client.save_file(path=media.thumb)
121
125
  raw_media = self.get_wrapped_animation(raw_file=raw_file, raw_thumb=raw_file_thumb, media=media, file_name=file_name)
122
126
 
123
127
  peer = await self.client.resolve_peer(chat_id)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: warp_beacon
3
- Version: 2.6.76
3
+ Version: 2.6.78
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
@@ -1,2 +0,0 @@
1
- __version__ = "2.6.76"
2
-
File without changes
File without changes
File without changes
File without changes
File without changes