warp-beacon 2.6.89__py3-none-any.whl → 2.6.90__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.89"
1
+ __version__ = "2.6.90"
2
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,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: warp_beacon
3
- Version: 2.6.89
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
@@ -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=AhxRZFfW4nuV1nG374FacuiUBDMNSLMJmo9LBJyboDs,24
7
+ warp_beacon/__version__.py,sha256=s1Gyn8bxYLPbGb2iRK_aVDbVJNFzFOD-7xUCIDIPtcQ,24
8
8
  warp_beacon/warp_beacon.py,sha256=ADCR30uGXIsDrt9WoiI9Ghu2QtWs0qZIK6x3pQKM_B4,1109
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,16 +22,16 @@ 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=JF5K8jgdwW0ncpKsEAj2yWMP9Y40kKgCM_i3HoHwNnM,8307
24
24
  warp_beacon/scheduler/scheduler.py,sha256=Bf4sGXjX75Dox3q-yzUHhagtzUAj3hl5GzfnZya-_io,4995
25
- warp_beacon/scraper/__init__.py,sha256=a-nnFAPvXtmJFQJOEbN2UL92FllK_7NTPM3Yoz_hYjk,20103
26
- warp_beacon/scraper/abstract.py,sha256=_Cr_MaSQ56Wp6n00PcqiM2WDa5DlRKXUnQ9C15bPObw,3692
27
- warp_beacon/scraper/account_selector.py,sha256=VmXH8SHZqQ6a2mrt2agzDWepE3v46QrFLL3OqVwJ2A4,9731
25
+ warp_beacon/scraper/__init__.py,sha256=k3M0X_m5f7b_DbBB3Ahk62ewEYr5AkqJL0PJXf0G4mI,20140
26
+ warp_beacon/scraper/abstract.py,sha256=pWbaTu-gDZgi-iFjqMR_uGzPl5KLv-4gTdJ9w6cD4sk,3802
27
+ warp_beacon/scraper/account_selector.py,sha256=eTAxA5Agf9TIey8-5zrv-uvCoRl5xR6jPvbmgLppSXk,9959
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
31
31
  warp_beacon/scraper/utils.py,sha256=Kk_lDmdJiCSaHmOV80OFK05O1wRL2H0agH98JiO8dyg,1268
32
32
  warp_beacon/scraper/instagram/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
33
  warp_beacon/scraper/instagram/captcha.py,sha256=9UYziuqB3Tsat_ET6ex-cnZDbi6yCnsXHSpmE8MuUHk,4651
34
- warp_beacon/scraper/instagram/instagram.py,sha256=64XxGui7bPuiJT-Hqlg1KQT9GsbX1YMXzEUJdzvkxLQ,17141
34
+ warp_beacon/scraper/instagram/instagram.py,sha256=4dhan3PO1dT8lCxHD5bdNuEvgutcNvYqxDNG93Wlkkg,17583
35
35
  warp_beacon/scraper/instagram/wb_instagrapi.py,sha256=OECHz1eK6J5bfw2H84CdywwxBNegkNb_UhDr0MtNtZ4,5237
36
36
  warp_beacon/scraper/youtube/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
37
  warp_beacon/scraper/youtube/abstract.py,sha256=0ub4O8kNBzcrYCbMaNoNQzwE5vBdpNcSYNtxT-cBXe4,15024
@@ -52,9 +52,9 @@ warp_beacon/telegram/progress_file_reader.py,sha256=e3equyNKlKs764AD-iE9QRsh3YDH
52
52
  warp_beacon/telegram/types.py,sha256=Kvdng6uCF1HRoqQgGW1ZYYPJoVuYkFb-LDvMBbW5Hjk,89
53
53
  warp_beacon/telegram/utils.py,sha256=1Lq67aRylVJzbwSyvAgjPAGjJZFATkICvAj3TJGuJiM,4635
54
54
  warp_beacon/uploader/__init__.py,sha256=j3qcuKhpchseZLGzSsSiogqe6WdMbkK8d3I-ConhNRs,5687
55
- warp_beacon-2.6.89.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
56
- warp_beacon-2.6.89.dist-info/METADATA,sha256=a3IGbK9FA8yZZxisbuboczOGs5zPXZKUmyN6PYhHmUo,22736
57
- warp_beacon-2.6.89.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
58
- warp_beacon-2.6.89.dist-info/entry_points.txt,sha256=eSB61Rb89d56WY0O-vEIQwkn18J-4CMrJcLA_R_8h3g,119
59
- warp_beacon-2.6.89.dist-info/top_level.txt,sha256=5YQRN46STNg81V_3jdzZ6bftkMxhe1hTPSFvJugDu84,1405
60
- warp_beacon-2.6.89.dist-info/RECORD,,
55
+ warp_beacon-2.6.90.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
56
+ warp_beacon-2.6.90.dist-info/METADATA,sha256=G6-5MRiRevMZ5yT9uHbvvyRarP692cJloM7XFDFI_kk,22736
57
+ warp_beacon-2.6.90.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
58
+ warp_beacon-2.6.90.dist-info/entry_points.txt,sha256=eSB61Rb89d56WY0O-vEIQwkn18J-4CMrJcLA_R_8h3g,119
59
+ warp_beacon-2.6.90.dist-info/top_level.txt,sha256=5YQRN46STNg81V_3jdzZ6bftkMxhe1hTPSFvJugDu84,1405
60
+ warp_beacon-2.6.90.dist-info/RECORD,,