warp-beacon 2.7.5__tar.gz → 2.7.7__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 (70) hide show
  1. {warp_beacon-2.7.5/warp_beacon.egg-info → warp_beacon-2.7.7}/PKG-INFO +1 -1
  2. warp_beacon-2.7.7/warp_beacon/__version__.py +2 -0
  3. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/jobs/download_job.py +2 -1
  4. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/scraper/__init__.py +5 -5
  5. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/scraper/instagram/instagram.py +6 -5
  6. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/telegram/handlers.py +3 -1
  7. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/telegram/progress_bar.py +1 -1
  8. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/telegram/utils.py +17 -2
  9. {warp_beacon-2.7.5 → warp_beacon-2.7.7/warp_beacon.egg-info}/PKG-INFO +1 -1
  10. warp_beacon-2.7.5/warp_beacon/__version__.py +0 -2
  11. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/LICENSE +0 -0
  12. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/MANIFEST.in +0 -0
  13. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/README.md +0 -0
  14. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/assets/cc-group-black.png +0 -0
  15. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/assets/placeholder.gif +0 -0
  16. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/etc/.gitignore +0 -0
  17. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/etc/accounts.json +0 -0
  18. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/etc/proxies.json +0 -0
  19. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/etc/warp_beacon.conf +0 -0
  20. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/etc/warp_beacon.service +0 -0
  21. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/pyproject.toml +0 -0
  22. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/setup.cfg +0 -0
  23. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/setup.py +0 -0
  24. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/__init__.py +0 -0
  25. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/compress/__init__.py +0 -0
  26. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/compress/video.py +0 -0
  27. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/jobs/__init__.py +0 -0
  28. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/jobs/abstract.py +0 -0
  29. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/jobs/types.py +0 -0
  30. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/jobs/upload_job.py +0 -0
  31. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/mediainfo/__init__.py +0 -0
  32. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/mediainfo/abstract.py +0 -0
  33. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/mediainfo/audio.py +0 -0
  34. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/mediainfo/silencer.py +0 -0
  35. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/mediainfo/video.py +0 -0
  36. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/scheduler/__init__.py +0 -0
  37. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/scheduler/instagram_human.py +0 -0
  38. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/scheduler/scheduler.py +0 -0
  39. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/scraper/abstract.py +0 -0
  40. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/scraper/account_selector.py +0 -0
  41. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/scraper/exceptions.py +0 -0
  42. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/scraper/fail_handler.py +0 -0
  43. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/scraper/instagram/__init__.py +0 -0
  44. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/scraper/instagram/captcha.py +0 -0
  45. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/scraper/instagram/wb_instagrapi.py +0 -0
  46. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/scraper/link_resolver.py +0 -0
  47. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/scraper/utils.py +0 -0
  48. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/scraper/youtube/__init__.py +0 -0
  49. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/scraper/youtube/abstract.py +0 -0
  50. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/scraper/youtube/music.py +0 -0
  51. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/scraper/youtube/shorts.py +0 -0
  52. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/scraper/youtube/youtube.py +0 -0
  53. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/storage/__init__.py +0 -0
  54. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/storage/mongo.py +0 -0
  55. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/telegram/__init__.py +0 -0
  56. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/telegram/bot.py +0 -0
  57. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/telegram/caption_shortener.py +0 -0
  58. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/telegram/download_status.py +0 -0
  59. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/telegram/edit_message.py +0 -0
  60. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/telegram/placeholder_message.py +0 -0
  61. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/telegram/progress_file_reader.py +0 -0
  62. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/telegram/types.py +0 -0
  63. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/uploader/__init__.py +0 -0
  64. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/warp_beacon.py +0 -0
  65. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon/yt_auth.py +0 -0
  66. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon.egg-info/SOURCES.txt +0 -0
  67. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon.egg-info/dependency_links.txt +0 -0
  68. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon.egg-info/entry_points.txt +0 -0
  69. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/warp_beacon.egg-info/requires.txt +0 -0
  70. {warp_beacon-2.7.5 → warp_beacon-2.7.7}/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.7.5
3
+ Version: 2.7.7
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.7.7"
2
+
@@ -1,4 +1,5 @@
1
1
  #from typing import TypedDict
2
+ import copy
2
3
  from typing_extensions import Unpack
3
4
 
4
5
  from warp_beacon.jobs.upload_job import UploadJob
@@ -16,7 +17,7 @@ class DownloadJob(AbstractJob):
16
17
 
17
18
  def to_upload_job(self, **kwargs: Unpack[JobSettings]) -> AbstractJob:
18
19
  d = self.to_dict()
19
- d.update(kwargs)
20
+ d.update(copy.deepcopy(kwargs))
20
21
  if "media_collection" in d:
21
22
  for index, _ in enumerate(d["media_collection"]):
22
23
  for k, _ in enumerate(d["media_collection"][index]):
@@ -290,14 +290,14 @@ class AsyncDownloader(object):
290
290
  break
291
291
  self.send_message_to_admin(
292
292
  f"Task <code>{job.job_id}</code> failed. URL: {job.url}. Reason: '<b>UnknownError</b>'."
293
- f"Exception:\n<pre code=\"python\">{exception_msg}<br></pre>"
293
+ f"Exception:\n<pre code=\"python\">{exception_msg}\n</pre>"
294
294
  )
295
295
  self.uploader.queue_task(job.to_upload_job(
296
296
  job_failed=True,
297
- job_failed_msg=f"Unknown error occured. Please <a href=\"https://github.com/sb0y/warp_beacon/issues\">create issue</a> with service logs.<br>"
298
- f"Task <code>{job.job_id}</code> failed. URL: {job.url}.<br>"
299
- f"Reason: '<b>UnknownError</b>'.<br>"
300
- f"Exception:<br><pre code=\"python\">{exception_msg}</pre>"
297
+ job_failed_msg=f"Unknown error occurred. Please <a href=\"https://github.com/sb0y/warp_beacon/issues\">create issue</a> with service logs.\n"
298
+ f"Task <code>{job.job_id}</code> failed. URL: {job.url}.\n"
299
+ f"Reason: '<b>UnknownError</b>'.\n"
300
+ f"Exception:\n<pre code=\"python\">{exception_msg}</pre>"
301
301
  ))
302
302
  break
303
303
  finally:
@@ -145,17 +145,18 @@ class InstagramScraper(ScraperAbstract):
145
145
  def scrap(self, url: str) -> tuple[str]:
146
146
  self.load_session()
147
147
  def _scrap() -> tuple[str]:
148
- if "stories" in url:
148
+ path = urlparse(url).path
149
+ slash_count = path.count('/')
150
+ if "stories" in url or slash_count == 1:
149
151
  # remove URL options
150
- _url = urljoin(url, urlparse(url).path)
152
+ _url = urljoin(url, path)
151
153
  url_last_part = list(filter(None, _url.split('/')))[-1]
152
154
  logging.debug("url last part: '%s'", url_last_part)
153
155
  if url_last_part.isnumeric():
154
156
  return "story", self.scrap_story(url)
155
- else:
157
+ elif slash_count in (1, 2):
156
158
  return "stories", url_last_part
157
- else:
158
- return "media", self.scrap_media(url)
159
+ return "media", self.scrap_media(url)
159
160
  try:
160
161
  return _scrap()
161
162
  except exceptions.LoginRequired as e:
@@ -148,10 +148,12 @@ class Handlers(object):
148
148
  msg_leftover = await Utils.handle_mentions(chat.id, client, msg_leftover)
149
149
  # remove duplicates
150
150
  urls = list(set(urls_raw))
151
+ # remove links without paths
152
+ urls = Utils.remove_links_wo_paths(urls)
151
153
 
152
154
  reply_text = "Wut?"
153
155
  if not urls:
154
- reply_text = "Your message should contains URLs"
156
+ reply_text = "Your message should contain URLs"
155
157
  else:
156
158
  for url in urls:
157
159
  origin = Utils.extract_origin(url)
@@ -9,7 +9,7 @@ from pyrogram import Client
9
9
  from warp_beacon.telegram.types import ReportType
10
10
 
11
11
  class ProgressBar(object):
12
- MAX_PROGRESS_RENDER_SIZE = 500_000 # 500 kB
12
+ MAX_PROGRESS_RENDER_SIZE = 1_500_000 # 1 MB
13
13
 
14
14
  def __init__(self, client: Client) -> None:
15
15
  self._next_threshold = 5
@@ -1,6 +1,6 @@
1
- from typing import Union, Optional
2
-
1
+ from typing import Optional
3
2
  import re
3
+ from urllib.parse import urlparse
4
4
 
5
5
  from pyrogram import Client
6
6
  from pyrogram.types import Message, ChatMember
@@ -154,3 +154,18 @@ class Utils(object):
154
154
  return
155
155
  if not client.me or not client.me.is_premium:
156
156
  client.me = await client.get_me()
157
+
158
+ @staticmethod
159
+ def remove_links_wo_paths(urls: list[str]) -> list[str]:
160
+ try:
161
+ new_urls = []
162
+ for url in urls:
163
+ url = url.rstrip('/')
164
+ path = urlparse(url).path
165
+ sc = path.count('/')
166
+ if sc > 0:
167
+ new_urls.append(url)
168
+ return new_urls
169
+ except Exception as e:
170
+ logging.warning("Failed to remove links without path!", exc_info=e)
171
+ return urls
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: warp_beacon
3
- Version: 2.7.5
3
+ Version: 2.7.7
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.7.5"
2
-
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes