warp-beacon 2.7.27__py3-none-any.whl → 2.7.29__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.27"
1
+ __version__ = "2.7.29"
2
2
 
@@ -78,29 +78,21 @@ class InstagramHuman(object):
78
78
  logging.info("raw_tray: %s", str(raw_tray))
79
79
  tray = raw_tray.get("tray", [])
80
80
  for user_story in tray:
81
- try:
82
- user = user_story["user"]
83
- #username = user["username"]
84
- user_id = user["pk"]
85
- _stories = self.scrapler.cl.user_stories(user_id)
86
- self.operations_count += 1
87
- if _stories:
88
- stories.extend(_stories)
89
- self.random_pause()
90
- except Exception as exc:
91
- logging.warning("Failed to fetch stories for user '%s'", user_story.get("user", {}).get("username", ""), exc_info=exc)
92
- self.random_pause()
93
- except Exception as e:
94
- logging.warning("Failed to get user stories!", exc_info=e)
81
+ user = user_story["user"]
82
+ user_id = user["pk"]
83
+ _stories = self.scrapler.download_hndlr(self.scrapler.cl.user_stories, user_id)
84
+ self.operations_count += 1
85
+ if _stories:
86
+ stories.extend(_stories)
87
+ self.random_pause()
95
88
 
96
- if not stories:
97
- return
89
+ if not stories:
90
+ return
98
91
 
99
- seen = []
100
- explore_user = None
101
- if stories:
102
- for m in stories[:random.randint(1, len(stories))]:
103
- try:
92
+ seen = []
93
+ explore_user = None
94
+ if stories:
95
+ for m in stories[:random.randint(1, len(stories))]:
104
96
  logging.info("Wathing story with pk '%s'", str(m.id))
105
97
  seen.append(str(m.id))
106
98
  if random.random() > 0.9:
@@ -108,19 +100,16 @@ class InstagramHuman(object):
108
100
  self.operations_count += 1
109
101
  break
110
102
  self.random_pause()
111
- except Exception as e:
112
- logging.warning("Exception while watching content", exc_info=e)
113
103
 
114
- if seen:
115
- try:
116
- self.scrapler.cl.media_seen(seen)
104
+ if seen:
105
+ self.scrapler.download_hndlr(self.scrapler.cl.media_seen, seen)
117
106
  self.operations_count += 1
118
107
  logging.info("Marked '%d' stories as seen", len(seen))
119
- except Exception as e:
120
- logging.warning("Failed to mark seen watched watch stories!", exc_info=e)
121
108
 
122
- if explore_user:
123
- 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)
124
113
 
125
114
  def watch_content(self, media: list) -> None:
126
115
  if not media:
@@ -129,22 +118,16 @@ class InstagramHuman(object):
129
118
  seen = []
130
119
  random.seed(time.time())
131
120
  for m in media[:random.randint(1, len(media))]:
132
- try:
133
- logging.info("Watching content with pk '%s'", str(m.id))
134
- seen.append(str(m.id))
135
- logging.info("Watched content with id '%s'", str(m.id))
136
- if random.random() > 0.9:
137
- explore_user = m.user
138
- break
139
- self.random_pause()
140
- except Exception as e:
141
- logging.warning("Exception while watching content")
142
- logging.exception(e)
143
- try:
144
- self.scrapler.download_hndlr(self.scrapler.cl.media_seen, seen)
145
- self.operations_count += 1
146
- except Exception as e:
147
- 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
148
131
 
149
132
  if explore_user:
150
133
  self.explore_profile(explore_user)
@@ -291,22 +274,18 @@ class InstagramHuman(object):
291
274
  threads = self.scrapler.download_hndlr(self.scrapler.cl.direct_threads, amount=random.randint(3, 7))
292
275
  self.operations_count += 1
293
276
  for thread in threads:
294
- try:
295
- messages = self.scrapler.cl.direct_messages(thread.id, amount=random.randint(5, 15))
296
- self.operations_count += 1
297
- if not messages:
298
- continue
299
- msg_sample = random.sample(messages, k=random.randint(1, min(len(messages), 5)))
300
- for msg in msg_sample:
301
- if random.random() < 0.85:
302
- #self.scrapler.cl.direct_message_seen(msg.thread_id, msg.id)
303
- #self.operations_count += 1
304
- logging.info("visual_media: '%s'", msg.visual_media)
305
- self.random_pause()
306
- self.random_pause()
307
- except Exception as e:
308
- logging.warning("Failed to read thread %s", thread.id)
309
- 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()
310
289
 
311
290
  def explore_profile(self, user: UserShort) -> None:
312
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.27
3
+ Version: 2.7.29
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=RXmJM6dnFS-VvyT2foMHomYU0KoNsVLPs8MHDkDSNYE,24
7
+ warp_beacon/__version__.py,sha256=_LmRNGKODzASrCmjGEfNEDs3DOuePsYcW-NkrlBYlMQ,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=hVDO25gaKR7KCDT0PlKzDxbTNBtfS7_TmEu9higexPc,13085
23
+ warp_beacon/scheduler/instagram_human.py,sha256=GHzATkWSGpxfXCFSCL3zW8m7GXaaPf8kP6Bk3NuwfzU,12360
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.27.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
56
- warp_beacon-2.7.27.dist-info/METADATA,sha256=Ttj2LlsTJcxokL1-rSLeAiD8_JDTNJpJxMC26LQJjtw,23215
57
- warp_beacon-2.7.27.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
58
- warp_beacon-2.7.27.dist-info/entry_points.txt,sha256=eSB61Rb89d56WY0O-vEIQwkn18J-4CMrJcLA_R_8h3g,119
59
- warp_beacon-2.7.27.dist-info/top_level.txt,sha256=5YQRN46STNg81V_3jdzZ6bftkMxhe1hTPSFvJugDu84,1405
60
- warp_beacon-2.7.27.dist-info/RECORD,,
55
+ warp_beacon-2.7.29.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
56
+ warp_beacon-2.7.29.dist-info/METADATA,sha256=bCy0h-Ft5baiFpToIipdqsjE-1Ex4e2c4VCnC-i-2Pk,23215
57
+ warp_beacon-2.7.29.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
58
+ warp_beacon-2.7.29.dist-info/entry_points.txt,sha256=eSB61Rb89d56WY0O-vEIQwkn18J-4CMrJcLA_R_8h3g,119
59
+ warp_beacon-2.7.29.dist-info/top_level.txt,sha256=5YQRN46STNg81V_3jdzZ6bftkMxhe1hTPSFvJugDu84,1405
60
+ warp_beacon-2.7.29.dist-info/RECORD,,