warp-beacon 2.7.23__tar.gz → 2.7.24__tar.gz

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.
Files changed (70) hide show
  1. {warp_beacon-2.7.23/warp_beacon.egg-info → warp_beacon-2.7.24}/PKG-INFO +1 -1
  2. warp_beacon-2.7.24/warp_beacon/__version__.py +2 -0
  3. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/scheduler/instagram_human.py +61 -37
  4. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/scraper/instagram/wb_instagrapi.py +19 -2
  5. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/scraper/utils.py +2 -2
  6. {warp_beacon-2.7.23 → warp_beacon-2.7.24/warp_beacon.egg-info}/PKG-INFO +1 -1
  7. warp_beacon-2.7.23/warp_beacon/__version__.py +0 -2
  8. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/LICENSE +0 -0
  9. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/MANIFEST.in +0 -0
  10. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/README.md +0 -0
  11. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/assets/cc-group-black.png +0 -0
  12. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/assets/placeholder.gif +0 -0
  13. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/etc/.gitignore +0 -0
  14. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/etc/accounts.json +0 -0
  15. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/etc/proxies.json +0 -0
  16. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/etc/warp_beacon.conf +0 -0
  17. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/etc/warp_beacon.service +0 -0
  18. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/pyproject.toml +0 -0
  19. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/setup.cfg +0 -0
  20. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/setup.py +0 -0
  21. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/__init__.py +0 -0
  22. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/compress/__init__.py +0 -0
  23. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/compress/video.py +0 -0
  24. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/jobs/__init__.py +0 -0
  25. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/jobs/abstract.py +0 -0
  26. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/jobs/download_job.py +0 -0
  27. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/jobs/types.py +0 -0
  28. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/jobs/upload_job.py +0 -0
  29. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/mediainfo/__init__.py +0 -0
  30. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/mediainfo/abstract.py +0 -0
  31. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/mediainfo/audio.py +0 -0
  32. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/mediainfo/silencer.py +0 -0
  33. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/mediainfo/video.py +0 -0
  34. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/scheduler/__init__.py +0 -0
  35. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/scheduler/scheduler.py +0 -0
  36. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/scraper/__init__.py +0 -0
  37. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/scraper/abstract.py +0 -0
  38. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/scraper/account_selector.py +0 -0
  39. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/scraper/exceptions.py +0 -0
  40. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/scraper/fail_handler.py +0 -0
  41. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/scraper/instagram/__init__.py +0 -0
  42. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/scraper/instagram/captcha.py +0 -0
  43. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/scraper/instagram/instagram.py +0 -0
  44. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/scraper/link_resolver.py +0 -0
  45. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/scraper/youtube/__init__.py +0 -0
  46. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/scraper/youtube/abstract.py +0 -0
  47. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/scraper/youtube/music.py +0 -0
  48. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/scraper/youtube/shorts.py +0 -0
  49. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/scraper/youtube/youtube.py +0 -0
  50. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/storage/__init__.py +0 -0
  51. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/storage/mongo.py +0 -0
  52. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/telegram/__init__.py +0 -0
  53. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/telegram/bot.py +0 -0
  54. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/telegram/caption_shortener.py +0 -0
  55. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/telegram/download_status.py +0 -0
  56. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/telegram/edit_message.py +0 -0
  57. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/telegram/handlers.py +0 -0
  58. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/telegram/placeholder_message.py +0 -0
  59. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/telegram/progress_bar.py +0 -0
  60. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/telegram/progress_file_reader.py +0 -0
  61. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/telegram/types.py +0 -0
  62. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/telegram/utils.py +0 -0
  63. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/uploader/__init__.py +0 -0
  64. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/warp_beacon.py +0 -0
  65. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon/yt_auth.py +0 -0
  66. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon.egg-info/SOURCES.txt +0 -0
  67. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon.egg-info/dependency_links.txt +0 -0
  68. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon.egg-info/entry_points.txt +0 -0
  69. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon.egg-info/requires.txt +0 -0
  70. {warp_beacon-2.7.23 → warp_beacon-2.7.24}/warp_beacon.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: warp_beacon
3
- Version: 2.7.23
3
+ Version: 2.7.24
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
@@ -0,0 +1,2 @@
1
+ __version__ = "2.7.24"
2
+
@@ -15,6 +15,14 @@ class InstagramHuman(object):
15
15
  self.scrapler = scrapler
16
16
  self.operations_count = 0
17
17
  self.was_profile_explore = False
18
+ self.tray_feed = None
19
+
20
+ def reel_tray_feed_if_needed(self, reason: str = "pull_to_refresh") -> dict:
21
+ if self.tray_feed is not None:
22
+ self.tray_feed = self.scrapler.download_hndlr(self.scrapler.cl.get_reels_tray_feed, reason)
23
+ self.operations_count += 1
24
+
25
+ return self.tray_feed
18
26
 
19
27
  def browse_timeline(self) -> Optional[dict]:
20
28
  feed = None
@@ -61,10 +69,25 @@ class InstagramHuman(object):
61
69
 
62
70
  def watch_stories(self) -> None:
63
71
  logging.info("Simulating stories watch ...")
64
- stories = None
72
+ stories = []
65
73
  try:
66
- stories = self.scrapler.cl.user_stories_v1(self.scrapler.cl.user_id)
67
- self.operations_count += 1
74
+ tray = self.reel_tray_feed_if_needed()
75
+ if not tray:
76
+ logging.info("No stories tray available.")
77
+ return
78
+ 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()
68
91
  except Exception as e:
69
92
  logging.warning("Failed to get user stories!", exc_info=e)
70
93
 
@@ -73,16 +96,18 @@ class InstagramHuman(object):
73
96
 
74
97
  seen = []
75
98
  explore_user = None
76
- for m in stories[:random.randint(1, len(stories))]:
77
- try:
78
- logging.info("Wathing story with pk '%s'", str(m.id))
79
- seen.append(str(m.id))
80
- if random.random() > 0.9:
81
- explore_user = m.user
82
- break
83
- self.random_pause()
84
- except Exception as e:
85
- logging.warning("Exception while watching content", exc_info=e)
99
+ if stories:
100
+ for m in stories[:random.randint(1, len(stories))]:
101
+ try:
102
+ logging.info("Wathing story with pk '%s'", str(m.id))
103
+ seen.append(str(m.id))
104
+ if random.random() > 0.9:
105
+ explore_user = m.user
106
+ self.operations_count += 1
107
+ break
108
+ self.random_pause()
109
+ except Exception as e:
110
+ logging.warning("Exception while watching content", exc_info=e)
86
111
 
87
112
  if seen:
88
113
  try:
@@ -163,14 +188,13 @@ class InstagramHuman(object):
163
188
  time.sleep(random.uniform(3, 7))
164
189
  if random.random() > 0.5:
165
190
  self.check_direct()
166
- #if random.random() > 0.6:
167
- # self.scrapler.download_hndlr(self.scrapler.cl.notification_like_and_comment_on_photo_user_tagged, "everyone")
168
- # self.operations_count += 1
169
- # self.random_pause()
191
+ if random.random() > 0.6:
192
+ self.scrapler.download_hndlr(self.scrapler.cl.notification_like_and_comment_on_photo_user_tagged, "everyone")
193
+ self.operations_count += 1
194
+ self.random_pause()
170
195
  if random.random() > 0.2:
171
196
  logging.info("Simulation updating reels tray feed ...")
172
- self.scrapler.download_hndlr(self.scrapler.cl.get_reels_tray_feed, "pull_to_refresh")
173
- self.operations_count += 1
197
+ self.reel_tray_feed_if_needed()
174
198
  self.random_pause()
175
199
  if random.random() > 0.4:
176
200
  self.watch_stories()
@@ -188,8 +212,7 @@ class InstagramHuman(object):
188
212
  self.browse_timeline()
189
213
  time.sleep(random.uniform(2, 5))
190
214
  if random.random() > 0.5:
191
- self.scrapler.download_hndlr(self.scrapler.cl.get_reels_tray_feed, "pull_to_refresh")
192
- self.operations_count += 1
215
+ self.reel_tray_feed_if_needed()
193
216
  self.random_pause()
194
217
 
195
218
  if random.random() > 0.4:
@@ -213,11 +236,11 @@ class InstagramHuman(object):
213
236
  time.sleep(random.uniform(2, 5))
214
237
  if random.random() > 0.5:
215
238
  self.check_direct()
216
- #if random.random() > 0.6:
217
- # logging.info("Checking notifications, tags ...")
218
- # self.scrapler.download_hndlr(self.scrapler.cl.notification_like_and_comment_on_photo_user_tagged, "everyone")
219
- # self.operations_count += 1
220
- # self.random_pause()
239
+ if random.random() > 0.6:
240
+ logging.info("Checking notifications, tags ...")
241
+ self.scrapler.download_hndlr(self.scrapler.cl.notification_like_and_comment_on_photo_user_tagged, "everyone")
242
+ self.operations_count += 1
243
+ self.random_pause()
221
244
  if random.random() > 0.4:
222
245
  self.watch_stories()
223
246
  self.random_pause()
@@ -274,8 +297,9 @@ class InstagramHuman(object):
274
297
  msg_sample = random.sample(messages, k=random.randint(1, min(len(messages), 5)))
275
298
  for msg in msg_sample:
276
299
  if random.random() < 0.85:
277
- self.scrapler.cl.direct_message_seen(msg.thread_id, msg.id)
278
- self.operations_count += 1
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)
279
303
  self.random_pause()
280
304
  self.random_pause()
281
305
  except Exception as e:
@@ -322,15 +346,15 @@ class InstagramHuman(object):
322
346
  if isinstance(random_friend, UserShort):
323
347
  target_user_id = random_friend.pk
324
348
  logging.info("user_info with target_user_id = '%s' ...", target_user_id)
325
- #self.scrapler.download_hndlr(self.scrapler.cl.user_info, target_user_id)
326
- self.scrapler.download_hndlr(self.scrapler.cl.user_info_v1, target_user_id)
349
+ self.scrapler.download_hndlr(self.scrapler.cl.user_info, target_user_id)
350
+ #self.scrapler.download_hndlr(self.scrapler.cl.user_info_v1, target_user_id)
327
351
  self.operations_count += 1
328
352
  self.random_pause()
329
353
  elif isinstance(random_friend, str):
330
354
  target_user_id = self.scrapler.download_hndlr(self.scrapler.cl.user_id_from_username, random_friend)
331
355
  logging.info("user_info with target_user_id = '%s' ...", target_user_id)
332
- #self.scrapler.download_hndlr(self.scrapler.cl.user_info, target_user_id)
333
- self.scrapler.download_hndlr(self.scrapler.cl.user_info_v1, target_user_id)
356
+ self.scrapler.download_hndlr(self.scrapler.cl.user_info, target_user_id)
357
+ #self.scrapler.download_hndlr(self.scrapler.cl.user_info_v1, target_user_id)
334
358
  self.operations_count += 1
335
359
  self.random_pause()
336
360
 
@@ -339,11 +363,11 @@ class InstagramHuman(object):
339
363
  if random.random() > 0.5:
340
364
  self.check_direct()
341
365
 
342
- #if random.random() > 0.3:
343
- # logging.info("Checking notifications, tags ...")
344
- # self.scrapler.download_hndlr(self.scrapler.cl.notification_like_and_comment_on_photo_user_tagged, "everyone")
345
- # self.operations_count += 1
346
- # self.random_pause()
366
+ if random.random() > 0.3:
367
+ logging.info("Checking notifications, tags ...")
368
+ self.scrapler.download_hndlr(self.scrapler.cl.notification_like_and_comment_on_photo_user_tagged, "everyone")
369
+ self.operations_count += 1
370
+ self.random_pause()
347
371
 
348
372
  if random.random() > 0.5:
349
373
  logging.info("user_medias with target_user_id = '%s' ...", target_user_id)
@@ -7,7 +7,7 @@ import time
7
7
  import requests
8
8
 
9
9
  from instagrapi import Client
10
- from instagrapi.types import Media, User
10
+ from instagrapi.types import Media, User, Story
11
11
  from instagrapi.exceptions import (
12
12
  #ClientError,
13
13
  #ClientLoginRequired,
@@ -306,4 +306,21 @@ class WBClient(Client):
306
306
  time.sleep(sleep)
307
307
  if amount:
308
308
  medias = medias[:amount]
309
- return medias
309
+ return medias
310
+
311
+ def user_stories(self, user_id: str, amount: int = None) -> List[Story]:
312
+ """
313
+ Get a user's stories
314
+
315
+ Parameters
316
+ ----------
317
+ user_id: str
318
+ amount: int, optional
319
+ Maximum number of story to return, default is all
320
+
321
+ Returns
322
+ -------
323
+ List[Story]
324
+ A list of objects of STory
325
+ """
326
+ return self.user_stories_v1(user_id, amount)
@@ -4,7 +4,7 @@ from fake_useragent import UserAgent
4
4
 
5
5
  class ScraperUtils(object):
6
6
  @staticmethod
7
- def get_ua_dict(browsers: list = None, platforms: list = ['mobile', 'tablet'], os: list = ['Android']) -> dict:
7
+ def get_ua_dict(browsers: list=['Facebook', 'Android'], platforms: list=['mobile', 'tablet'], os: list=['Android', 'iOS']) -> dict:
8
8
  random_client = None
9
9
  try:
10
10
  ua = UserAgent(browsers=browsers, platforms=platforms, os=os)
@@ -16,5 +16,5 @@ class ScraperUtils(object):
16
16
  return random_client
17
17
 
18
18
  @staticmethod
19
- def get_ua(browsers: list = None, platforms: list = ['mobile', 'tablet'], os: list = ['Android']) -> str:
19
+ def get_ua(browsers: list=['Facebook', 'Android'], platforms: list=['mobile', 'tablet'], os: list=['Android', 'iOS']) -> str:
20
20
  return ScraperUtils.get_ua_dict(browsers=browsers, platforms=platforms, os=os)["useragent"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: warp_beacon
3
- Version: 2.7.23
3
+ Version: 2.7.24
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
@@ -1,2 +0,0 @@
1
- __version__ = "2.7.23"
2
-
File without changes
File without changes
File without changes
File without changes
File without changes