warp-beacon 2.7.26__py3-none-any.whl → 2.7.28__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.7.26"
1
+ __version__ = "2.7.28"
2
2
 
@@ -71,34 +71,28 @@ class InstagramHuman(object):
71
71
  logging.info("Simulating stories watch ...")
72
72
  stories = []
73
73
  try:
74
- tray = self.reel_tray_feed_if_needed()
75
- if not tray:
74
+ raw_tray = self.reel_tray_feed_if_needed()
75
+ if not raw_tray:
76
76
  logging.info("No stories tray available.")
77
77
  return
78
+ logging.info("raw_tray: %s", str(raw_tray))
79
+ tray = raw_tray.get("tray", [])
78
80
  for user_story in tray:
79
- try:
80
- user = user_story["user"]
81
- #username = user["username"]
82
- user_id = user["pk"]
83
- _stories = self.scrapler.cl.user_stories(user_id)
84
- self.operations_count += 1
85
- if _stories:
86
- stories.extend(_stories)
87
- self.random_pause()
88
- except Exception as exc:
89
- logging.warning("Failed to fetch stories for user '%s'", user_story.get("user", {}).get("username", ""), exc_info=exc)
90
- self.random_pause()
91
- except Exception as e:
92
- logging.warning("Failed to get user stories!", exc_info=e)
81
+ user = user_story["user"]
82
+ user_id = user["pk"]
83
+ _stories = self.scrapler.cl.user_stories(user_id)
84
+ self.operations_count += 1
85
+ if _stories:
86
+ stories.extend(_stories)
87
+ self.random_pause()
93
88
 
94
- if not stories:
95
- return
89
+ if not stories:
90
+ return
96
91
 
97
- seen = []
98
- explore_user = None
99
- if stories:
100
- for m in stories[:random.randint(1, len(stories))]:
101
- try:
92
+ seen = []
93
+ explore_user = None
94
+ if stories:
95
+ for m in stories[:random.randint(1, len(stories))]:
102
96
  logging.info("Wathing story with pk '%s'", str(m.id))
103
97
  seen.append(str(m.id))
104
98
  if random.random() > 0.9:
@@ -106,19 +100,16 @@ class InstagramHuman(object):
106
100
  self.operations_count += 1
107
101
  break
108
102
  self.random_pause()
109
- except Exception as e:
110
- logging.warning("Exception while watching content", exc_info=e)
111
103
 
112
- if seen:
113
- try:
104
+ if seen:
114
105
  self.scrapler.cl.media_seen(seen)
115
106
  self.operations_count += 1
116
107
  logging.info("Marked '%d' stories as seen", len(seen))
117
- except Exception as e:
118
- logging.warning("Failed to mark seen watched watch stories!", exc_info=e)
119
108
 
120
- if explore_user:
121
- self.explore_profile(explore_user)
109
+ if explore_user:
110
+ self.explore_profile(explore_user)
111
+ except Exception as e:
112
+ logging.warning("Failed to get user stories!", exc_info=e)
122
113
 
123
114
  def watch_content(self, media: list) -> None:
124
115
  if not media:
@@ -127,22 +118,16 @@ class InstagramHuman(object):
127
118
  seen = []
128
119
  random.seed(time.time())
129
120
  for m in media[:random.randint(1, len(media))]:
130
- try:
131
- logging.info("Watching content with pk '%s'", str(m.id))
132
- seen.append(str(m.id))
133
- logging.info("Watched content with id '%s'", str(m.id))
134
- if random.random() > 0.9:
135
- explore_user = m.user
136
- break
137
- self.random_pause()
138
- except Exception as e:
139
- logging.warning("Exception while watching content")
140
- logging.exception(e)
141
- try:
142
- self.scrapler.download_hndlr(self.scrapler.cl.media_seen, seen)
143
- self.operations_count += 1
144
- except Exception as e:
145
- logging.warning("Failed to mark seen watched videos!", exc_info=e)
121
+ logging.info("Watching content with pk '%s'", str(m.id))
122
+ seen.append(str(m.id))
123
+ logging.info("Watched content with id '%s'", str(m.id))
124
+ if random.random() > 0.9:
125
+ explore_user = m.user
126
+ break
127
+ self.random_pause()
128
+
129
+ self.scrapler.download_hndlr(self.scrapler.cl.media_seen, seen)
130
+ self.operations_count += 1
146
131
 
147
132
  if explore_user:
148
133
  self.explore_profile(explore_user)
@@ -289,22 +274,18 @@ class InstagramHuman(object):
289
274
  threads = self.scrapler.download_hndlr(self.scrapler.cl.direct_threads, amount=random.randint(3, 7))
290
275
  self.operations_count += 1
291
276
  for thread in threads:
292
- try:
293
- messages = self.scrapler.cl.direct_messages(thread.id, amount=random.randint(5, 15))
294
- self.operations_count += 1
295
- if not messages:
296
- continue
297
- msg_sample = random.sample(messages, k=random.randint(1, min(len(messages), 5)))
298
- for msg in msg_sample:
299
- if random.random() < 0.85:
300
- #self.scrapler.cl.direct_message_seen(msg.thread_id, msg.id)
301
- #self.operations_count += 1
302
- logging.info("visual_media: '%s'", msg.visual_media)
303
- self.random_pause()
304
- self.random_pause()
305
- except Exception as e:
306
- logging.warning("Failed to read thread %s", thread.id)
307
- logging.exception(e)
277
+ messages = self.scrapler.cl.direct_messages(thread.id, amount=random.randint(5, 15))
278
+ self.operations_count += 1
279
+ if not messages:
280
+ continue
281
+ #msg_sample = random.sample(messages, k=random.randint(1, min(len(messages), 5)))
282
+ #for msg in msg_sample:
283
+ #if random.random() < 0.85:
284
+ #self.scrapler.cl.direct_message_seen(msg.thread_id, msg.id)
285
+ #self.operations_count += 1
286
+ #logging.info("visual_media: '%s'", msg.visual_media)
287
+ #self.random_pause()
288
+ #self.random_pause()
308
289
 
309
290
  def explore_profile(self, user: UserShort) -> None:
310
291
  try:
@@ -130,8 +130,10 @@ class AsyncDownloader(object):
130
130
  proxy = selector.get_current_proxy()
131
131
  if job.job_origin is Origin.INSTAGRAM:
132
132
  from warp_beacon.scraper.instagram.instagram import InstagramScraper
133
- if not job.scroll_content and selector.get_ig_request_count() >= int(os.environ.get("IG_REQUESTS_PER_ACCOUNT", default="20")):
134
- logging.info("The account request limit has been reached. Selecting the next account.")
133
+ ig_requests_limit = int(os.environ.get("IG_REQUESTS_PER_ACCOUNT", default="20"))
134
+ ig_requests = selector.get_ig_request_count()
135
+ if not job.scroll_content and ig_requests >= ig_requests_limit:
136
+ logging.info("The account requests limit '%d' has been reached value '%d'. Selecting the next account.", ig_requests_limit, ig_requests)
135
137
  selector.reset_ig_request_count()
136
138
  selector.next()
137
139
  actor = InstagramScraper(client_session_id=selector.get_ig_session_id(), account=selector.get_current(), proxy=proxy)
@@ -165,8 +167,10 @@ class AsyncDownloader(object):
165
167
  break
166
168
  if job.session_validation and job.job_origin in (Origin.INSTAGRAM, Origin.YOUTUBE):
167
169
  if job.job_origin is Origin.INSTAGRAM:
168
- if selector.get_ig_request_count() >= int(os.environ.get("IG_REQUESTS_PER_ACCOUNT", default="20")):
169
- logging.info("The account request limit has been reached. Selecting the next account.")
170
+ ig_requests_limit = int(os.environ.get("IG_REQUESTS_PER_ACCOUNT", default="20"))
171
+ if selector.get_ig_request_count() >= ig_requests_limit:
172
+ ig_requests = selector.get_ig_request_count()
173
+ logging.info("The account requests limit '%d' has been reached value '%d'. Selecting the next account.", ig_requests_limit, ig_requests)
170
174
  selector.reset_ig_request_count()
171
175
  selector.next()
172
176
  logging.info("Validating '%s' session ...", job.job_origin.value)
@@ -257,13 +257,13 @@ class AccountSelector(object):
257
257
  return len(self.accounts[module_name])
258
258
 
259
259
  def inc_ig_request_count(self, amount: int = 1) -> None:
260
- self.ig_request_count.value += amount
260
+ self.ig_request_count.value += int(amount)
261
261
 
262
262
  def reset_ig_request_count(self) -> None:
263
263
  self.ig_request_count.value = 0
264
264
 
265
265
  def get_ig_request_count(self) -> int:
266
- return self.ig_request_count.value
266
+ return int(self.ig_request_count.value)
267
267
 
268
268
  def get_ig_session_id(self) -> str:
269
269
  with self.lock:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: warp_beacon
3
- Version: 2.7.26
3
+ Version: 2.7.28
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=eUUWphuXRLKxPiStOYd_iV1b6072Re2bdgLRNfwafWE,24
7
+ warp_beacon/__version__.py,sha256=Hv9ZUAYOf_ulq4EQYcILCKdzu42DKZy3ZHo70ig8luM,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
@@ -20,11 +20,11 @@ warp_beacon/mediainfo/audio.py,sha256=ous88kwQj4bDIChN5wnGil5LqTs0IQHH0d-nyrL0-Z
20
20
  warp_beacon/mediainfo/silencer.py,sha256=qxMuViOoVwUYb60uCVvqHiGrqByR1_4_rqMT-XdMkwc,1813
21
21
  warp_beacon/mediainfo/video.py,sha256=UBZrhTN5IDI-aYu6tsJEILo9nFkjHhkldGVFmvV7tEI,2480
22
22
  warp_beacon/scheduler/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
- warp_beacon/scheduler/instagram_human.py,sha256=ps78aNyNogT3_YEt_efqPODTVuRagq4svt8piBFGxW0,12995
23
+ warp_beacon/scheduler/instagram_human.py,sha256=jjdadrJwMFRVg3hhD5l5td8gfB081_Hm0FhRwpexkk4,12300
24
24
  warp_beacon/scheduler/scheduler.py,sha256=Bf4sGXjX75Dox3q-yzUHhagtzUAj3hl5GzfnZya-_io,4995
25
- warp_beacon/scraper/__init__.py,sha256=gQOcBvZNnlxt0Rbbrkl4PLh7eQe2y3igJbx-87hAvrA,20249
25
+ warp_beacon/scraper/__init__.py,sha256=i5R8nI0qE8c63lC4vVmggepsNr6-PNI2tPLR9UmcnXI,20534
26
26
  warp_beacon/scraper/abstract.py,sha256=pWbaTu-gDZgi-iFjqMR_uGzPl5KLv-4gTdJ9w6cD4sk,3802
27
- warp_beacon/scraper/account_selector.py,sha256=vxIVesGPQKVtL3uSn5CFlZB1eAYowUN7lTeiGUFmtDk,10067
27
+ warp_beacon/scraper/account_selector.py,sha256=ixdFN8sCyFPL_WTzer2pur0Ak3pH4Ih0P90qOM8_f9Y,10077
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
@@ -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=S1N_JbHM_ExiM5tS0CeYKWIlvaJMlyq85TQNbK_GVds,5029
54
54
  warp_beacon/uploader/__init__.py,sha256=ewvR60k9osJxw_kb5U-TlZkCGR_574biq3w_aR1tjIU,5689
55
- warp_beacon-2.7.26.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
56
- warp_beacon-2.7.26.dist-info/METADATA,sha256=4_vaiigbkAD00vo36C6GYLgosKnGfeFDvDtIp1NzJHE,23215
57
- warp_beacon-2.7.26.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
58
- warp_beacon-2.7.26.dist-info/entry_points.txt,sha256=eSB61Rb89d56WY0O-vEIQwkn18J-4CMrJcLA_R_8h3g,119
59
- warp_beacon-2.7.26.dist-info/top_level.txt,sha256=5YQRN46STNg81V_3jdzZ6bftkMxhe1hTPSFvJugDu84,1405
60
- warp_beacon-2.7.26.dist-info/RECORD,,
55
+ warp_beacon-2.7.28.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
56
+ warp_beacon-2.7.28.dist-info/METADATA,sha256=TAH_H_zfiXOi_foBfZ5iMKn2w1gP19FBvYBUmVfXipM,23215
57
+ warp_beacon-2.7.28.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
58
+ warp_beacon-2.7.28.dist-info/entry_points.txt,sha256=eSB61Rb89d56WY0O-vEIQwkn18J-4CMrJcLA_R_8h3g,119
59
+ warp_beacon-2.7.28.dist-info/top_level.txt,sha256=5YQRN46STNg81V_3jdzZ6bftkMxhe1hTPSFvJugDu84,1405
60
+ warp_beacon-2.7.28.dist-info/RECORD,,