warp-beacon 2.3.46__py3-none-any.whl → 2.3.48__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.3.46"
1
+ __version__ = "2.3.48"
2
2
 
@@ -32,10 +32,10 @@ class InstagramHuman(object):
32
32
  logging.info("Starting morning activity simulation")
33
33
  self.scrapler.timeline_cursor = self.scrapler.download_hndlr(self.scrapler.cl.get_timeline_feed, "pull_to_refresh", self.scrapler.timeline_cursor.get("next_max_id"))
34
34
  time.sleep(random.uniform(3, 7))
35
- if random.random() > 0.7:
35
+ if random.random() > 0.5:
36
36
  self.scrapler.download_hndlr(self.scrapler.cl.direct_active_presence)
37
37
  time.sleep(random.uniform(2, 5))
38
- if random.random() > 0.7:
38
+ if random.random() > 0.3:
39
39
  self.scrapler.download_hndlr(self.scrapler.cl.notification_like_and_comment_on_photo_user_tagged, "everyone")
40
40
  self.random_pause()
41
41
  if random.random() > 0.5:
@@ -53,7 +53,7 @@ class InstagramHuman(object):
53
53
  logging.info("Starting day fast check activity simulation")
54
54
  self.scrapler.download_hndlr(self.scrapler.cl.get_timeline_feed, "pull_to_refresh")
55
55
  time.sleep(random.uniform(2, 5))
56
- if random.random() > 0.7:
56
+ if random.random() > 0.5:
57
57
  self.scrapler.download_hndlr(self.scrapler.cl.get_reels_tray_feed, "pull_to_refresh")
58
58
  self.random_pause()
59
59
  except Exception as e:
@@ -67,10 +67,10 @@ class InstagramHuman(object):
67
67
  time.sleep(random.uniform(2, 5))
68
68
  self.scrapler.download_hndlr(self.scrapler.cl.get_reels_tray_feed, "pull_to_refresh")
69
69
  time.sleep(random.uniform(2, 5))
70
- if random.random() > 0.7:
70
+ if random.random() > 0.5:
71
71
  self.scrapler.download_hndlr(self.scrapler.cl.direct_active_presence)
72
72
  time.sleep(random.uniform(2, 5))
73
- if random.random() > 0.7:
73
+ if random.random() > 0.5:
74
74
  self.scrapler.download_hndlr(self.scrapler.cl.notification_like_and_comment_on_photo_user_tagged, "everyone")
75
75
  self.random_pause()
76
76
  if random.random() > 0.4:
@@ -88,7 +88,7 @@ class InstagramHuman(object):
88
88
  def night_routine(self) -> None:
89
89
  try:
90
90
  logging.info("Starting night activity simulation")
91
- if random.random() > 0.8:
91
+ if random.random() > 0.7:
92
92
  self.scrapler.download_hndlr(self.scrapler.cl.direct_active_presence)
93
93
  self.random_pause(short=True)
94
94
  except Exception as e:
@@ -124,11 +124,10 @@ class InstagramHuman(object):
124
124
 
125
125
  time.sleep(random.uniform(2, 5))
126
126
 
127
- if random.random() > 0.7:
127
+ if random.random() > 0.5:
128
128
  logging.info("user_medias with target_user_id = '%s' ...", target_user_id)
129
129
  self.scrapler.download_hndlr(self.scrapler.cl.user_medias, target_user_id, amount=random.randint(1, 5))
130
-
131
- self.random_pause()
130
+ self.random_pause()
132
131
  except Exception as e:
133
132
  logging.warning("Error in profile view")
134
133
  logging.exception(e)
@@ -12,11 +12,12 @@ import logging
12
12
 
13
13
  class IGScheduler(object):
14
14
  state_file = "/var/warp_beacon/scheduler_state.json"
15
+ yt_sessions_dir = "/var/warp_beacon"
15
16
  downloader = None
16
17
  running = True
17
18
  thread = None
18
19
  event = None
19
- state = {"remaining": randrange(8400, 26200)}
20
+ state = {"remaining": randrange(8400, 26200), "yt_sess_exp": []}
20
21
 
21
22
  def __init__(self, downloader: warp_beacon.scraper.AsyncDownloader) -> None:
22
23
  self.downloader = downloader
@@ -29,17 +30,32 @@ class IGScheduler(object):
29
30
  try:
30
31
  with open(self.state_file, 'w+', encoding="utf-8") as f:
31
32
  f.write(json.dumps(self.state))
33
+ self.load_yt_sessions()
32
34
  except Exception as e:
33
35
  logging.error("Failed to save Scheduler state!")
34
36
  logging.exception(e)
35
37
 
38
+ def load_yt_sessions(self) -> None:
39
+ try:
40
+ for f in os.listdir(self.yt_sessions_dir):
41
+ if f.startswith("yt_session") and f.endswith(".json"):
42
+ yt_sess_file = f"{self.yt_sessions_dir}/{f}"
43
+ if os.path.exists(yt_sess_file):
44
+ with open(yt_sess_file, 'r', encoding="utf-8") as f:
45
+ yt_sess_data = json.loads(f.read())
46
+ exp = yt_sess_data.get("expires", "")
47
+ self.state["yt_sess_exp"].append({"expires": exp, "file_path": yt_sess_file})
48
+ except Exception as e:
49
+ logging.error("Failed to load yt sessions!")
50
+ logging.exception(e)
51
+
36
52
  def load_state(self) -> None:
37
53
  try:
38
54
  if os.path.exists(self.state_file):
39
55
  with open(self.state_file, 'r', encoding="utf-8") as f:
40
56
  self.state = json.loads(f.read())
41
57
  if "remaining" in self.state:
42
- logging.info("Next scheduler activity in '%s' seconds", self.state["remaining"])
58
+ logging.info("Next scheduler activity in '%d' seconds", int(self.state["remaining"]))
43
59
  except Exception as e:
44
60
  logging.error("Failed to load Scheduler state!")
45
61
  logging.exception(e)
@@ -73,6 +89,20 @@ class IGScheduler(object):
73
89
  session_validation=True,
74
90
  job_origin=Origin.INSTAGRAM
75
91
  ))
92
+ return True
93
+ except Exception as e:
94
+ logging.warning("An error occurred while validating instagram session!")
95
+ logging.exception(e)
96
+
97
+ return False
98
+
99
+ def validate_yt_session(self) -> bool:
100
+ try:
101
+ self.downloader.queue_task(warp_beacon.jobs.download_job.DownloadJob.build(
102
+ session_validation=True,
103
+ job_origin=Origin.YOUTUBE
104
+ ))
105
+ return True
76
106
  except Exception as e:
77
107
  logging.warning("An error occurred while validating instagram session!")
78
108
  logging.exception(e)
@@ -91,7 +121,7 @@ class IGScheduler(object):
91
121
  self.save_state()
92
122
 
93
123
  if self.state["remaining"] <= 0:
94
- self.state["remaining"] = randrange(4292, 8623)
124
+ self.state["remaining"] = randrange(2292, 4623)
95
125
  logging.info("Next scheduler activity in '%s' seconds", self.state["remaining"])
96
126
 
97
127
  start_time = time.time()
@@ -38,7 +38,6 @@ class AccountSelector(object):
38
38
  if proxy_file_path:
39
39
  with open(proxy_file_path, 'r', encoding="utf-8") as f:
40
40
  self.proxies = json.loads(f.read())
41
- self.current_proxy = self.get_random_account_proxy()
42
41
  else:
43
42
  raise ValueError("Accounts file not found")
44
43
 
@@ -129,6 +128,7 @@ class AccountSelector(object):
129
128
  self.current_module_name = module_name
130
129
  if self.current is None:
131
130
  self.current = self.accounts[self.current_module_name][self.account_index[self.current_module_name].value]
131
+ self.current_proxy = self.get_random_account_proxy()
132
132
 
133
133
  def next(self) -> dict:
134
134
  idx = self.account_index[self.current_module_name].value
@@ -313,7 +313,7 @@ class YoutubeAbstract(ScraperAbstract):
313
313
  try:
314
314
  ret = self.download_hndlr(self._download, job.url, session=True)
315
315
  return ret
316
- except (Unavailable, TimeOut):
316
+ except (Unavailable, TimeOut, KeyError):
317
317
  logging.warning("Download failed, trying to download with yt_dlp")
318
318
 
319
319
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: warp_beacon
3
- Version: 2.3.46
3
+ Version: 2.3.48
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=WwmzdMPCUOj0exfQEPh8jozMYxz4FGxv_V9AJozlyKM,24
7
+ warp_beacon/__version__.py,sha256=_0vYd8U-6HbZtC8IVno_XmtRARoilb6yzu47OGCV5IE,24
8
8
  warp_beacon/warp_beacon.py,sha256=7KEtZDj-pdhtl6m-zFLsSojs1ZR4o7L0xbqtdmYPvfE,342
9
9
  warp_beacon/compress/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  warp_beacon/compress/video.py,sha256=_PDMVYCyzLYxHv1uZmmzGcG_8rjaZr7BTXsXTTy_oS4,2846
@@ -19,18 +19,18 @@ warp_beacon/mediainfo/audio.py,sha256=ous88kwQj4bDIChN5wnGil5LqTs0IQHH0d-nyrL0-Z
19
19
  warp_beacon/mediainfo/silencer.py,sha256=qxMuViOoVwUYb60uCVvqHiGrqByR1_4_rqMT-XdMkwc,1813
20
20
  warp_beacon/mediainfo/video.py,sha256=UBZrhTN5IDI-aYu6tsJEILo9nFkjHhkldGVFmvV7tEI,2480
21
21
  warp_beacon/scheduler/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
- warp_beacon/scheduler/instagram_human.py,sha256=K3S14uav0UBZidtREYwgCOCDKyDfWbay5GH-DWMK_JI,5020
23
- warp_beacon/scheduler/scheduler.py,sha256=ddPhExSgj_RGR1eSDlIm0hVgTVM_76UEMEl9i-eYuQ8,2915
22
+ warp_beacon/scheduler/instagram_human.py,sha256=GRzryMWws4ibJZ_gPGn_Y2I2plcPIVgMWK3Yubqywa0,5020
23
+ warp_beacon/scheduler/scheduler.py,sha256=krAi3ghWw84GoiGhItlZ8kMe1yxTf0Y5WAj9RJ1D82M,3935
24
24
  warp_beacon/scraper/__init__.py,sha256=cxRbhXFW69KbAWE8b2-j9pfUBSMSh95aNyf0GFluyig,17188
25
25
  warp_beacon/scraper/abstract.py,sha256=28a0aBKZpi8IKptLWdB6RuVbOkrUbrhT7LSZX7QRQtg,2725
26
- warp_beacon/scraper/account_selector.py,sha256=FyoZ0-YGuxqWzepIqgwJmPn0AC9u13RQC3F7Cl-BVoc,6284
26
+ warp_beacon/scraper/account_selector.py,sha256=HSfmi5H73aWYTjDa8GErCCQpTwWtDLBw92Q-I8TZilg,6282
27
27
  warp_beacon/scraper/exceptions.py,sha256=L4UCZqDOLKu5-TPUcTErIbNDLrAQJghkMaPqzTfsm1g,1376
28
28
  warp_beacon/scraper/fail_handler.py,sha256=_blvckfTZ4xWVancQKVRXH5ClKGwfrBxMwvXIFZh1qA,975
29
29
  warp_beacon/scraper/link_resolver.py,sha256=Rc9ZuMyOo3iPywDHwjngy-WRQ2SXhJwxcg-5ripx7tM,2447
30
30
  warp_beacon/scraper/instagram/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
31
  warp_beacon/scraper/instagram/instagram.py,sha256=TpIBS9S3zcLbeGax4CENVo6WP75EE6oIttc-MjWYVjs,13815
32
32
  warp_beacon/scraper/youtube/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
- warp_beacon/scraper/youtube/abstract.py,sha256=gGtWjsFCcJ8kYDXD4BtWCQ04uYW0jdIwWexJ84p8wFU,11788
33
+ warp_beacon/scraper/youtube/abstract.py,sha256=cO40GXICfHussKa-yySvYVwnONG9FYYa9n-ft-rh4y4,11798
34
34
  warp_beacon/scraper/youtube/music.py,sha256=-R6Iys8IpglH5UL7F640UQ3ieYHitvGXA0A2GhSemVA,2927
35
35
  warp_beacon/scraper/youtube/shorts.py,sha256=TVQP-Dm4ZV3bHd7u25yOpDHRzoXL3jUAszDb6ZW8p0U,1269
36
36
  warp_beacon/scraper/youtube/youtube.py,sha256=B1NBz6vv0-zIuf3MDmT2QB7eX2qO8k9orj7-4wU6MBk,2839
@@ -43,9 +43,9 @@ warp_beacon/telegram/handlers.py,sha256=XXIfdV_RCj7tyZMPXchuKmGoDdweOaR08ADDaBPW
43
43
  warp_beacon/telegram/placeholder_message.py,sha256=wN9-BRiyrtHG-EvXtZkGJHt2CX71munQ57ITttjt0mw,6400
44
44
  warp_beacon/telegram/utils.py,sha256=9uebX53G16mV7ER7WgfdWBLFHHw14S8HBt9URrIskg0,4440
45
45
  warp_beacon/uploader/__init__.py,sha256=E9rlZIf7xlQz6MutMOwJ8S5Vm2uheR5nv23Kv8duRQg,5427
46
- warp_beacon-2.3.46.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
47
- warp_beacon-2.3.46.dist-info/METADATA,sha256=p7yMyzJosIJhR3oM0REGyQzBej8DhsXIrMdKqAPg9HY,22626
48
- warp_beacon-2.3.46.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
49
- warp_beacon-2.3.46.dist-info/entry_points.txt,sha256=eSB61Rb89d56WY0O-vEIQwkn18J-4CMrJcLA_R_8h3g,119
50
- warp_beacon-2.3.46.dist-info/top_level.txt,sha256=qGjHVVfyf6lTmbdSA-fQq0rHS1YVS4HoJT3rag5xgPE,1141
51
- warp_beacon-2.3.46.dist-info/RECORD,,
46
+ warp_beacon-2.3.48.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
47
+ warp_beacon-2.3.48.dist-info/METADATA,sha256=zAStN9my7ODNTQIAIwdoq9jNETZU5HXZzBFT19SKIrg,22626
48
+ warp_beacon-2.3.48.dist-info/WHEEL,sha256=DK49LOLCYiurdXXOXwGJm6U4DkHkg4lcxjhqwRa0CP4,91
49
+ warp_beacon-2.3.48.dist-info/entry_points.txt,sha256=eSB61Rb89d56WY0O-vEIQwkn18J-4CMrJcLA_R_8h3g,119
50
+ warp_beacon-2.3.48.dist-info/top_level.txt,sha256=qGjHVVfyf6lTmbdSA-fQq0rHS1YVS4HoJT3rag5xgPE,1141
51
+ warp_beacon-2.3.48.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (77.0.3)
2
+ Generator: setuptools (78.0.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5