warp-beacon 2.6.88__tar.gz → 2.6.90__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.6.88/warp_beacon.egg-info → warp_beacon-2.6.90}/PKG-INFO +1 -1
  2. warp_beacon-2.6.90/warp_beacon/__version__.py +2 -0
  3. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/scraper/__init__.py +1 -0
  4. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/scraper/abstract.py +3 -0
  5. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/scraper/account_selector.py +8 -1
  6. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/scraper/instagram/instagram.py +18 -8
  7. warp_beacon-2.6.90/warp_beacon/warp_beacon.py +39 -0
  8. {warp_beacon-2.6.88 → warp_beacon-2.6.90/warp_beacon.egg-info}/PKG-INFO +1 -1
  9. warp_beacon-2.6.88/warp_beacon/__version__.py +0 -2
  10. warp_beacon-2.6.88/warp_beacon/warp_beacon.py +0 -14
  11. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/LICENSE +0 -0
  12. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/MANIFEST.in +0 -0
  13. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/README.md +0 -0
  14. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/assets/placeholder.gif +0 -0
  15. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/etc/.gitignore +0 -0
  16. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/etc/accounts.json +0 -0
  17. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/etc/proxies.json +0 -0
  18. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/etc/warp_beacon.conf +0 -0
  19. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/etc/warp_beacon.service +0 -0
  20. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/pyproject.toml +0 -0
  21. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/setup.cfg +0 -0
  22. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/setup.py +0 -0
  23. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/__init__.py +0 -0
  24. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/compress/__init__.py +0 -0
  25. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/compress/video.py +0 -0
  26. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/jobs/__init__.py +0 -0
  27. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/jobs/abstract.py +0 -0
  28. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/jobs/download_job.py +0 -0
  29. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/jobs/types.py +0 -0
  30. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/jobs/upload_job.py +0 -0
  31. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/mediainfo/__init__.py +0 -0
  32. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/mediainfo/abstract.py +0 -0
  33. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/mediainfo/audio.py +0 -0
  34. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/mediainfo/silencer.py +0 -0
  35. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/mediainfo/video.py +0 -0
  36. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/scheduler/__init__.py +0 -0
  37. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/scheduler/instagram_human.py +0 -0
  38. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/scheduler/scheduler.py +0 -0
  39. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/scraper/exceptions.py +0 -0
  40. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/scraper/fail_handler.py +0 -0
  41. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/scraper/instagram/__init__.py +0 -0
  42. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/scraper/instagram/captcha.py +0 -0
  43. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/scraper/instagram/wb_instagrapi.py +0 -0
  44. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/scraper/link_resolver.py +0 -0
  45. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/scraper/utils.py +0 -0
  46. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/scraper/youtube/__init__.py +0 -0
  47. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/scraper/youtube/abstract.py +0 -0
  48. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/scraper/youtube/music.py +0 -0
  49. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/scraper/youtube/shorts.py +0 -0
  50. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/scraper/youtube/youtube.py +0 -0
  51. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/storage/__init__.py +0 -0
  52. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/storage/mongo.py +0 -0
  53. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/telegram/__init__.py +0 -0
  54. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/telegram/bot.py +0 -0
  55. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/telegram/caption_shortener.py +0 -0
  56. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/telegram/download_status.py +0 -0
  57. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/telegram/edit_message.py +0 -0
  58. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/telegram/handlers.py +0 -0
  59. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/telegram/placeholder_message.py +0 -0
  60. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/telegram/progress_bar.py +0 -0
  61. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/telegram/progress_file_reader.py +0 -0
  62. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/telegram/types.py +0 -0
  63. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/telegram/utils.py +0 -0
  64. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/uploader/__init__.py +0 -0
  65. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon/yt_auth.py +0 -0
  66. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon.egg-info/SOURCES.txt +0 -0
  67. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon.egg-info/dependency_links.txt +0 -0
  68. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon.egg-info/entry_points.txt +0 -0
  69. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/warp_beacon.egg-info/requires.txt +0 -0
  70. {warp_beacon-2.6.88 → warp_beacon-2.6.90}/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.88
3
+ Version: 2.6.90
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.90"
2
+
@@ -150,6 +150,7 @@ class AsyncDownloader(object):
150
150
  actor.auth_event = self.auth_event
151
151
  actor.status_pipe = self.status_pipe
152
152
  actor.yt_validate_event = self.yt_validate_event
153
+ actor.acc_selector = selector
153
154
  # job retry loop
154
155
  while self.allow_loop.value == 1:
155
156
  try:
@@ -16,6 +16,8 @@ import requests.packages.urllib3.util.connection as urllib3_cn
16
16
  if TYPE_CHECKING:
17
17
  from multiprocessing.synchronize import Event as EventType
18
18
 
19
+ from warp_beacon.scraper.account_selector import AccountSelector
20
+
19
21
  class ScraperAbstract(ABC):
20
22
  def __init__(self, account: tuple, proxy: dict = None) -> None:
21
23
  self.original_gai_family = None
@@ -24,6 +26,7 @@ class ScraperAbstract(ABC):
24
26
  self.status_pipe: multiprocessing.connection.Connection = None
25
27
  self.yt_validate_event: EventType = None
26
28
  self.auth_event = None
29
+ self.acc_selector: AccountSelector = None
27
30
  self.account = None
28
31
  self.account_index = 0
29
32
  self.proxy = None
@@ -271,4 +271,11 @@ class AccountSelector(object):
271
271
  #if random.random() > 0.95:
272
272
  # self.ig_accounts_session_id[idx] = str(uuid.uuid4())
273
273
  # logging.info("Rotated client_session_id — simulating app restart")
274
- return self.ig_accounts_session_id[idx]
274
+ return self.ig_accounts_session_id[idx]
275
+
276
+ def generate_new_session_id(self) -> str:
277
+ with self.lock:
278
+ idx = self.account_index[self.current_module_name].value
279
+ session_id = str(uuid.uuid4())
280
+ self.ig_accounts_session_id[idx] = session_id
281
+ return session_id
@@ -208,14 +208,24 @@ class InstagramScraper(ScraperAbstract):
208
208
  except exceptions.LoginRequired as e:
209
209
  logging.error("LoginRequired occurred in download handler!")
210
210
  logging.exception(e)
211
- old_session = self.cl.get_settings()
212
- self.cl.set_settings({})
213
- self.setup_device()
214
- self.cl.set_uuids(old_session["uuids"])
215
- if os.path.exists(self.inst_session_file):
216
- os.unlink(self.inst_session_file)
217
- time.sleep(5)
218
- self.load_session()
211
+ relogin_success = False
212
+ if self.cl.relogin_attempt > 1:
213
+ try:
214
+ relogin_success = self.cl.relogin()
215
+ except Exception as exc:
216
+ logging.warning("Relogin failed!", exc_info=exc)
217
+ if not relogin_success:
218
+ old_session = self.cl.get_settings()
219
+ # change session id after relogin
220
+ self.client_session_id = self.acc_selector.generate_new_session_id()
221
+ old_session["uuids"]["client_session_id"] = self.client_session_id
222
+ self.cl.set_settings({})
223
+ self.setup_device()
224
+ self.cl.set_uuids(old_session["uuids"])
225
+ if os.path.exists(self.inst_session_file):
226
+ os.unlink(self.inst_session_file)
227
+ time.sleep(random.uniform(5, 10))
228
+ self.load_session()
219
229
  except AssertionError as e:
220
230
  raise IGRateLimitOccurred("IG rate limit occurred")
221
231
  except (socket.timeout,
@@ -0,0 +1,39 @@
1
+ import os
2
+ import sys
3
+ import uuid
4
+ import secrets
5
+ import hashlib
6
+ import argparse
7
+
8
+ from warp_beacon.telegram.bot import Bot
9
+
10
+ #import logging
11
+
12
+ def generate_uuid() -> str:
13
+ return str(uuid.uuid4())
14
+
15
+ def generate_device_id(seed: str = None) -> str:
16
+ raw = secrets.token_hex(8) if not seed else seed.encode()
17
+ hex_part = hashlib.md5(raw).hexdigest()[:16]
18
+ return f"android-{hex_part}"
19
+
20
+ def main() -> None:
21
+ parser = argparse.ArgumentParser(description="Warp Beacon Telegram bot.")
22
+ parser.add_argument("--uuid", action="store_true", help="Generate UUID")
23
+ parser.add_argument("--generate-device-id", type=str, metavar="INSTAGRAM_LOGIN", help="Generate device_id with account login")
24
+
25
+ args = parser.parse_args()
26
+
27
+ if args.uuid:
28
+ print(generate_uuid())
29
+ elif args.generate_device_id:
30
+ print(generate_device_id(args.generate_device_id))
31
+ else:
32
+ bot = Bot(
33
+ tg_bot_name=os.environ.get("TG_BOT_NAME", default=None),
34
+ tg_token=os.environ.get("TG_TOKEN", default=None),
35
+ tg_api_id=os.environ.get("TG_API_ID", default=None),
36
+ tg_api_hash=os.environ.get("TG_API_HASH", default=None)
37
+ )
38
+ bot.start()
39
+ sys.exit(0)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: warp_beacon
3
- Version: 2.6.88
3
+ Version: 2.6.90
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.88"
2
-
@@ -1,14 +0,0 @@
1
- import os
2
-
3
- from warp_beacon.telegram.bot import Bot
4
-
5
- #import logging
6
-
7
- def main() -> None:
8
- bot = Bot(
9
- tg_bot_name=os.environ.get("TG_BOT_NAME", default=None),
10
- tg_token=os.environ.get("TG_TOKEN", default=None),
11
- tg_api_id=os.environ.get("TG_API_ID", default=None),
12
- tg_api_hash=os.environ.get("TG_API_HASH", default=None)
13
- )
14
- bot.start()
File without changes
File without changes
File without changes
File without changes
File without changes