warp-beacon 2.3.47__tar.gz → 2.3.49__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.
- {warp_beacon-2.3.47/warp_beacon.egg-info → warp_beacon-2.3.49}/PKG-INFO +1 -1
- warp_beacon-2.3.49/warp_beacon/__version__.py +2 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon/scheduler/instagram_human.py +8 -9
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon/scheduler/scheduler.py +37 -3
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon/scraper/__init__.py +6 -4
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon/scraper/instagram/instagram.py +3 -1
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon/scraper/youtube/abstract.py +1 -1
- {warp_beacon-2.3.47 → warp_beacon-2.3.49/warp_beacon.egg-info}/PKG-INFO +1 -1
- warp_beacon-2.3.47/warp_beacon/__version__.py +0 -2
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/LICENSE +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/MANIFEST.in +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/README.md +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/assets/placeholder.gif +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/etc/.gitignore +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/etc/accounts.json +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/etc/proxies.json +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/etc/warp_beacon.conf +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/etc/warp_beacon.service +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/pyproject.toml +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/setup.cfg +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/setup.py +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon/__init__.py +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon/compress/__init__.py +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon/compress/video.py +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon/jobs/__init__.py +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon/jobs/abstract.py +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon/jobs/download_job.py +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon/jobs/types.py +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon/jobs/upload_job.py +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon/mediainfo/__init__.py +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon/mediainfo/abstract.py +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon/mediainfo/audio.py +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon/mediainfo/silencer.py +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon/mediainfo/video.py +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon/scheduler/__init__.py +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon/scraper/abstract.py +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon/scraper/account_selector.py +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon/scraper/exceptions.py +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon/scraper/fail_handler.py +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon/scraper/instagram/__init__.py +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon/scraper/link_resolver.py +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon/scraper/youtube/__init__.py +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon/scraper/youtube/music.py +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon/scraper/youtube/shorts.py +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon/scraper/youtube/youtube.py +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon/storage/__init__.py +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon/storage/mongo.py +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon/telegram/__init__.py +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon/telegram/bot.py +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon/telegram/caption_shortener.py +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon/telegram/handlers.py +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon/telegram/placeholder_message.py +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon/telegram/utils.py +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon/uploader/__init__.py +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon/warp_beacon.py +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon.egg-info/SOURCES.txt +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon.egg-info/dependency_links.txt +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon.egg-info/entry_points.txt +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon.egg-info/requires.txt +0 -0
- {warp_beacon-2.3.47 → warp_beacon-2.3.49}/warp_beacon.egg-info/top_level.txt +0 -0
@@ -32,10 +32,10 @@ class InstagramHuman(object):
|
|
32
32
|
logging.info("Starting morning activity simulation")
|
33
33
|
self.scrapler.timeline_cursor = self.scrapler.download_hndlr(self.scrapler.cl.get_timeline_feed, "pull_to_refresh", self.scrapler.timeline_cursor.get("next_max_id"))
|
34
34
|
time.sleep(random.uniform(3, 7))
|
35
|
-
if random.random() > 0.
|
35
|
+
if random.random() > 0.5:
|
36
36
|
self.scrapler.download_hndlr(self.scrapler.cl.direct_active_presence)
|
37
37
|
time.sleep(random.uniform(2, 5))
|
38
|
-
if random.random() > 0.
|
38
|
+
if random.random() > 0.3:
|
39
39
|
self.scrapler.download_hndlr(self.scrapler.cl.notification_like_and_comment_on_photo_user_tagged, "everyone")
|
40
40
|
self.random_pause()
|
41
41
|
if random.random() > 0.5:
|
@@ -53,7 +53,7 @@ class InstagramHuman(object):
|
|
53
53
|
logging.info("Starting day fast check activity simulation")
|
54
54
|
self.scrapler.download_hndlr(self.scrapler.cl.get_timeline_feed, "pull_to_refresh")
|
55
55
|
time.sleep(random.uniform(2, 5))
|
56
|
-
if random.random() > 0.
|
56
|
+
if random.random() > 0.5:
|
57
57
|
self.scrapler.download_hndlr(self.scrapler.cl.get_reels_tray_feed, "pull_to_refresh")
|
58
58
|
self.random_pause()
|
59
59
|
except Exception as e:
|
@@ -67,10 +67,10 @@ class InstagramHuman(object):
|
|
67
67
|
time.sleep(random.uniform(2, 5))
|
68
68
|
self.scrapler.download_hndlr(self.scrapler.cl.get_reels_tray_feed, "pull_to_refresh")
|
69
69
|
time.sleep(random.uniform(2, 5))
|
70
|
-
if random.random() > 0.
|
70
|
+
if random.random() > 0.5:
|
71
71
|
self.scrapler.download_hndlr(self.scrapler.cl.direct_active_presence)
|
72
72
|
time.sleep(random.uniform(2, 5))
|
73
|
-
if random.random() > 0.
|
73
|
+
if random.random() > 0.5:
|
74
74
|
self.scrapler.download_hndlr(self.scrapler.cl.notification_like_and_comment_on_photo_user_tagged, "everyone")
|
75
75
|
self.random_pause()
|
76
76
|
if random.random() > 0.4:
|
@@ -88,7 +88,7 @@ class InstagramHuman(object):
|
|
88
88
|
def night_routine(self) -> None:
|
89
89
|
try:
|
90
90
|
logging.info("Starting night activity simulation")
|
91
|
-
if random.random() > 0.
|
91
|
+
if random.random() > 0.7:
|
92
92
|
self.scrapler.download_hndlr(self.scrapler.cl.direct_active_presence)
|
93
93
|
self.random_pause(short=True)
|
94
94
|
except Exception as e:
|
@@ -124,11 +124,10 @@ class InstagramHuman(object):
|
|
124
124
|
|
125
125
|
time.sleep(random.uniform(2, 5))
|
126
126
|
|
127
|
-
if random.random() > 0.
|
127
|
+
if random.random() > 0.5:
|
128
128
|
logging.info("user_medias with target_user_id = '%s' ...", target_user_id)
|
129
129
|
self.scrapler.download_hndlr(self.scrapler.cl.user_medias, target_user_id, amount=random.randint(1, 5))
|
130
|
-
|
131
|
-
self.random_pause()
|
130
|
+
self.random_pause()
|
132
131
|
except Exception as e:
|
133
132
|
logging.warning("Error in profile view")
|
134
133
|
logging.exception(e)
|
@@ -12,11 +12,12 @@ import logging
|
|
12
12
|
|
13
13
|
class IGScheduler(object):
|
14
14
|
state_file = "/var/warp_beacon/scheduler_state.json"
|
15
|
+
yt_sessions_dir = "/var/warp_beacon"
|
15
16
|
downloader = None
|
16
17
|
running = True
|
17
18
|
thread = None
|
18
19
|
event = None
|
19
|
-
state = {"remaining": randrange(8400, 26200)}
|
20
|
+
state = {"remaining": randrange(8400, 26200), "yt_sess_exp": []}
|
20
21
|
|
21
22
|
def __init__(self, downloader: warp_beacon.scraper.AsyncDownloader) -> None:
|
22
23
|
self.downloader = downloader
|
@@ -29,17 +30,36 @@ class IGScheduler(object):
|
|
29
30
|
try:
|
30
31
|
with open(self.state_file, 'w+', encoding="utf-8") as f:
|
31
32
|
f.write(json.dumps(self.state))
|
33
|
+
self.load_yt_sessions()
|
32
34
|
except Exception as e:
|
33
35
|
logging.error("Failed to save Scheduler state!")
|
34
36
|
logging.exception(e)
|
35
37
|
|
38
|
+
def load_yt_sessions(self) -> None:
|
39
|
+
try:
|
40
|
+
# old versions migration
|
41
|
+
if not "yt_sess_exp" in self.state:
|
42
|
+
self.state["yt_sess_exp"] = []
|
43
|
+
|
44
|
+
for f in os.listdir(self.yt_sessions_dir):
|
45
|
+
if f.startswith("yt_session") and f.endswith(".json"):
|
46
|
+
yt_sess_file = f"{self.yt_sessions_dir}/{f}"
|
47
|
+
if os.path.exists(yt_sess_file):
|
48
|
+
with open(yt_sess_file, 'r', encoding="utf-8") as f:
|
49
|
+
yt_sess_data = json.loads(f.read())
|
50
|
+
exp = yt_sess_data.get("expires", "")
|
51
|
+
self.state["yt_sess_exp"].append({"expires": exp, "file_path": yt_sess_file})
|
52
|
+
except Exception as e:
|
53
|
+
logging.error("Failed to load yt sessions!")
|
54
|
+
logging.exception(e)
|
55
|
+
|
36
56
|
def load_state(self) -> None:
|
37
57
|
try:
|
38
58
|
if os.path.exists(self.state_file):
|
39
59
|
with open(self.state_file, 'r', encoding="utf-8") as f:
|
40
60
|
self.state = json.loads(f.read())
|
41
61
|
if "remaining" in self.state:
|
42
|
-
logging.info("Next scheduler activity in '%
|
62
|
+
logging.info("Next scheduler activity in '%d' seconds", int(self.state["remaining"]))
|
43
63
|
except Exception as e:
|
44
64
|
logging.error("Failed to load Scheduler state!")
|
45
65
|
logging.exception(e)
|
@@ -73,6 +93,20 @@ class IGScheduler(object):
|
|
73
93
|
session_validation=True,
|
74
94
|
job_origin=Origin.INSTAGRAM
|
75
95
|
))
|
96
|
+
return True
|
97
|
+
except Exception as e:
|
98
|
+
logging.warning("An error occurred while validating instagram session!")
|
99
|
+
logging.exception(e)
|
100
|
+
|
101
|
+
return False
|
102
|
+
|
103
|
+
def validate_yt_session(self) -> bool:
|
104
|
+
try:
|
105
|
+
self.downloader.queue_task(warp_beacon.jobs.download_job.DownloadJob.build(
|
106
|
+
session_validation=True,
|
107
|
+
job_origin=Origin.YOUTUBE
|
108
|
+
))
|
109
|
+
return True
|
76
110
|
except Exception as e:
|
77
111
|
logging.warning("An error occurred while validating instagram session!")
|
78
112
|
logging.exception(e)
|
@@ -91,7 +125,7 @@ class IGScheduler(object):
|
|
91
125
|
self.save_state()
|
92
126
|
|
93
127
|
if self.state["remaining"] <= 0:
|
94
|
-
self.state["remaining"] = randrange(
|
128
|
+
self.state["remaining"] = randrange(2292, 4623)
|
95
129
|
logging.info("Next scheduler activity in '%s' seconds", self.state["remaining"])
|
96
130
|
|
97
131
|
start_time = time.time()
|
@@ -275,13 +275,15 @@ class AsyncDownloader(object):
|
|
275
275
|
self.job_queue.put(job)
|
276
276
|
break
|
277
277
|
self.send_message_to_admin(
|
278
|
-
f"Task <code>{job.job_id}</code> failed. URL:
|
279
|
-
f"Exception:\n<pre code=\"python\"
|
278
|
+
f"Task <code>{job.job_id}</code> failed. URL: {job.url}. Reason: '<b>UnknownError</b>'."
|
279
|
+
f"Exception:\n<pre code=\"python\">{exception_msg}\n</pre>"
|
280
280
|
)
|
281
281
|
self.uploader.queue_task(job.to_upload_job(
|
282
282
|
job_failed=True,
|
283
|
-
job_failed_msg="
|
284
|
-
|
283
|
+
job_failed_msg=("Unknown error occured. Please <a href=\"https://github.com/sb0y/warp_beacon/issues\">create issue</a> with service logs.\n",
|
284
|
+
f"Task <code>{job.job_id}</code> failed. URL: {job.url}. Reason: '<b>UnknownError</b>'.\n",
|
285
|
+
f"Exception:\n<pre code=\"python\">{exception_msg}\n</pre>")
|
286
|
+
))
|
285
287
|
break
|
286
288
|
|
287
289
|
if items:
|
@@ -18,7 +18,7 @@ from instagrapi.types import Media
|
|
18
18
|
from instagrapi import Client
|
19
19
|
from instagrapi.mixins.challenge import ChallengeChoice
|
20
20
|
from instagrapi.exceptions import LoginRequired, PleaseWaitFewMinutes, MediaNotFound, ClientNotFoundError, UserNotFound, ChallengeRequired, \
|
21
|
-
ChallengeSelfieCaptcha, ChallengeUnknownStep, UnknownError as IGUnknownError
|
21
|
+
ChallengeSelfieCaptcha, ChallengeUnknownStep, AssertionError, UnknownError as IGUnknownError
|
22
22
|
|
23
23
|
from warp_beacon.scraper.exceptions import NotFound, UnknownError, TimeOut, IGRateLimitOccurred, CaptchaIssue, extract_exception_message
|
24
24
|
from warp_beacon.scraper.abstract import ScraperAbstract
|
@@ -167,6 +167,8 @@ class InstagramScraper(ScraperAbstract):
|
|
167
167
|
os.unlink(self.inst_session_file)
|
168
168
|
time.sleep(5)
|
169
169
|
self.load_session()
|
170
|
+
except AssertionError as e:
|
171
|
+
raise IGRateLimitOccurred("IG rate limit occurred")
|
170
172
|
except (socket.timeout,
|
171
173
|
ssl.SSLError,
|
172
174
|
requests.exceptions.ConnectionError,
|
@@ -313,7 +313,7 @@ class YoutubeAbstract(ScraperAbstract):
|
|
313
313
|
try:
|
314
314
|
ret = self.download_hndlr(self._download, job.url, session=True)
|
315
315
|
return ret
|
316
|
-
except (Unavailable, TimeOut):
|
316
|
+
except (Unavailable, TimeOut, KeyError):
|
317
317
|
logging.warning("Download failed, trying to download with yt_dlp")
|
318
318
|
|
319
319
|
try:
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|