warp-beacon 2.6.36__py3-none-any.whl → 2.6.38__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.36"
1
+ __version__ = "2.6.38"
2
2
 
@@ -56,9 +56,6 @@ class AsyncDownloader(object):
56
56
  if os.environ.get("TG_PREMIUM", default="false") == "true":
57
57
  self.TG_FILE_LIMIT = 4294967296 # 4 GiB
58
58
 
59
- def __del__(self) -> None:
60
- self.stop_all()
61
-
62
59
  def start(self) -> None:
63
60
  for _ in range(self.workers_count):
64
61
  proc = multiprocessing.Process(target=self.do_work, args=(self.acc_selector, self.process_context))
@@ -26,13 +26,16 @@ class AccountSelector(object):
26
26
  current_proxy = None
27
27
  ig_request_count = None
28
28
  ig_accounts_session_id = None
29
+ lock = None
29
30
 
30
31
  def __init__(self, manager: multiprocessing.managers.SyncManager, acc_file_path: str, proxy_file_path: str=None) -> None:
31
32
  self.accounts = []
32
33
  self.proxies = []
33
34
  self.account_index = {}
34
- self.ig_accounts_session_id = self.load_ig_sessions_id()
35
35
  self.manager = manager
36
+ self.lock = self.manager.Lock()
37
+ self.ig_accounts_session_id = self.manager.dict()
38
+ self.load_ig_sessions_id()
36
39
  self.accounts_meta_data = self.manager.dict()
37
40
  if os.path.exists(acc_file_path):
38
41
  with open(acc_file_path, 'r', encoding="utf-8") as f:
@@ -63,19 +66,20 @@ class AccountSelector(object):
63
66
  logging.warning("Failed to save session ig_session_client_id!")
64
67
  logging.exception(e)
65
68
 
66
- def load_ig_sessions_id(self) -> dict:
67
- ig_sessions_client_id = {}
69
+ def load_ig_sessions_id(self) -> None:
68
70
  try:
69
71
  sess_file = f"{self.session_dir}/ig_sessions_client_id.json"
70
72
  if os.path.exists(sess_file):
73
+ data = None
71
74
  with open(sess_file, 'r', encoding="utf-8") as f:
72
- ig_sessions_client_id = json.loads(f.read())
75
+ data = json.loads(f.read())
76
+ if data and isinstance(data, dict):
77
+ for k, v in data.items():
78
+ self.ig_accounts_session_id[k] = v
73
79
  except Exception as e:
74
80
  logging.warning("Failed to read session ig_session_client_id!")
75
81
  logging.exception(e)
76
82
 
77
- return ig_sessions_client_id
78
-
79
83
  def save_ig_request_count(self) -> None:
80
84
  try:
81
85
  state = {"ig_count": self.ig_request_count.value}
@@ -259,11 +263,12 @@ class AccountSelector(object):
259
263
  return self.ig_request_count.value
260
264
 
261
265
  def get_ig_session_id(self) -> str:
262
- idx = self.account_index[self.current_module_name].value
263
- if idx not in self.ig_accounts_session_id:
264
- self.ig_accounts_session_id[idx] = str(uuid.uuid4())
265
- else:
266
- if random.random() > 0.95:
266
+ with self.lock:
267
+ idx = self.account_index[self.current_module_name].value
268
+ if idx not in self.ig_accounts_session_id:
267
269
  self.ig_accounts_session_id[idx] = str(uuid.uuid4())
268
- logging.info("Rotated client_session_id — simulating app restart")
269
- return self.ig_accounts_session_id[idx]
270
+ else:
271
+ if random.random() > 0.95:
272
+ self.ig_accounts_session_id[idx] = str(uuid.uuid4())
273
+ logging.info("Rotated client_session_id — simulating app restart")
274
+ return self.ig_accounts_session_id[idx]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: warp_beacon
3
- Version: 2.6.36
3
+ Version: 2.6.38
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=_Okq2e30zcA4ex25c2Jer542e7Q7oV8JO-jXCV7fGE4,24
7
+ warp_beacon/__version__.py,sha256=CzGvQVuj99cUjAvhgGLIbDwYZE06WXkvUaCJNUoEi_Q,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
@@ -22,9 +22,9 @@ warp_beacon/mediainfo/video.py,sha256=UBZrhTN5IDI-aYu6tsJEILo9nFkjHhkldGVFmvV7tE
22
22
  warp_beacon/scheduler/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
23
  warp_beacon/scheduler/instagram_human.py,sha256=0LaRUu0MBBuEOQeFzuq22HIYfJL9pTK_7udsXfef0Fk,8204
24
24
  warp_beacon/scheduler/scheduler.py,sha256=9OCh7Ta4wY_aTHGAOOZmaKXg56Ftx1N_aV1g6E3ZLKA,4941
25
- warp_beacon/scraper/__init__.py,sha256=AaUd30PSJi5CCqP_UQ25Hbz6W7Y0CEyza1eV4ji4xeU,20029
25
+ warp_beacon/scraper/__init__.py,sha256=NAx81O85yP0vUP1uZ9VHZlXh-zZgN_LHm7gWcU5BV18,19982
26
26
  warp_beacon/scraper/abstract.py,sha256=yP76ae9U73LYW2lDN6XWkXDkWX1h2UVOrkqv0Sqpu2Y,2985
27
- warp_beacon/scraper/account_selector.py,sha256=hqlNgyU53eJd4QgZl30EfIGeuIJx3uGUTffCRUY4rNs,9576
27
+ warp_beacon/scraper/account_selector.py,sha256=_QOezkVM2GqiuseZ72h8U0WmOYFuRoUXEHIDqNl4Nxs,9721
28
28
  warp_beacon/scraper/exceptions.py,sha256=EKwoF0oH2xZWbNU-v8DOaWK5skKwa3s1yTIBdlcfMpc,1452
29
29
  warp_beacon/scraper/fail_handler.py,sha256=zcPK3ZVEsu6JmHYcWP7L3naTRK3gWFVRkpP84VBOtJs,964
30
30
  warp_beacon/scraper/link_resolver.py,sha256=Rc9ZuMyOo3iPywDHwjngy-WRQ2SXhJwxcg-5ripx7tM,2447
@@ -46,9 +46,9 @@ warp_beacon/telegram/handlers.py,sha256=uvR6TPHSqdSxigp3wR-ewiE6t3TvVcbVLVcYGwkg
46
46
  warp_beacon/telegram/placeholder_message.py,sha256=wN9-BRiyrtHG-EvXtZkGJHt2CX71munQ57ITttjt0mw,6400
47
47
  warp_beacon/telegram/utils.py,sha256=1Lq67aRylVJzbwSyvAgjPAGjJZFATkICvAj3TJGuJiM,4635
48
48
  warp_beacon/uploader/__init__.py,sha256=j3qcuKhpchseZLGzSsSiogqe6WdMbkK8d3I-ConhNRs,5687
49
- warp_beacon-2.6.36.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
50
- warp_beacon-2.6.36.dist-info/METADATA,sha256=RkVAbx2Csottafgg4OuVmiGdqvQiRFWU45zP8eK_lKw,22706
51
- warp_beacon-2.6.36.dist-info/WHEEL,sha256=GHB6lJx2juba1wDgXDNlMTyM13ckjBMKf-OnwgKOCtA,91
52
- warp_beacon-2.6.36.dist-info/entry_points.txt,sha256=eSB61Rb89d56WY0O-vEIQwkn18J-4CMrJcLA_R_8h3g,119
53
- warp_beacon-2.6.36.dist-info/top_level.txt,sha256=aFsWDQBplsMOyVMGGJ8iu-auZ25z1e_IB4tM2M8kW1A,1187
54
- warp_beacon-2.6.36.dist-info/RECORD,,
49
+ warp_beacon-2.6.38.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
50
+ warp_beacon-2.6.38.dist-info/METADATA,sha256=wPkz6QdKjQdNAMi4CstB37WhSTw9ZpdaOO2eocCz3Ps,22706
51
+ warp_beacon-2.6.38.dist-info/WHEEL,sha256=GHB6lJx2juba1wDgXDNlMTyM13ckjBMKf-OnwgKOCtA,91
52
+ warp_beacon-2.6.38.dist-info/entry_points.txt,sha256=eSB61Rb89d56WY0O-vEIQwkn18J-4CMrJcLA_R_8h3g,119
53
+ warp_beacon-2.6.38.dist-info/top_level.txt,sha256=aFsWDQBplsMOyVMGGJ8iu-auZ25z1e_IB4tM2M8kW1A,1187
54
+ warp_beacon-2.6.38.dist-info/RECORD,,