warp-beacon 2.2.61__py3-none-any.whl → 2.2.63__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.
- warp_beacon/__version__.py +1 -1
- warp_beacon/scraper/__init__.py +16 -5
- warp_beacon/scraper/fail_handler.py +48 -0
- warp_beacon/telegram/utils.py +1 -1
- {warp_beacon-2.2.61.dist-info → warp_beacon-2.2.63.dist-info}/METADATA +1 -1
- {warp_beacon-2.2.61.dist-info → warp_beacon-2.2.63.dist-info}/RECORD +10 -9
- {warp_beacon-2.2.61.dist-info → warp_beacon-2.2.63.dist-info}/top_level.txt +1 -0
- {warp_beacon-2.2.61.dist-info → warp_beacon-2.2.63.dist-info}/LICENSE +0 -0
- {warp_beacon-2.2.61.dist-info → warp_beacon-2.2.63.dist-info}/WHEEL +0 -0
- {warp_beacon-2.2.61.dist-info → warp_beacon-2.2.63.dist-info}/entry_points.txt +0 -0
warp_beacon/__version__.py
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
__version__ = "2.2.
|
1
|
+
__version__ = "2.2.63"
|
2
2
|
|
warp_beacon/scraper/__init__.py
CHANGED
@@ -16,6 +16,7 @@ from warp_beacon.jobs.download_job import DownloadJob
|
|
16
16
|
from warp_beacon.jobs.upload_job import UploadJob
|
17
17
|
from warp_beacon.jobs.types import JobType
|
18
18
|
from warp_beacon.scraper.account_selector import AccountSelector
|
19
|
+
from warp_beacon.scraper.fail_handler import FailHandler
|
19
20
|
|
20
21
|
import logging
|
21
22
|
|
@@ -32,6 +33,7 @@ class AsyncDownloader(object):
|
|
32
33
|
manager = None
|
33
34
|
acc_selector = None
|
34
35
|
scheduler = None
|
36
|
+
fail_handler = FailHandler()
|
35
37
|
|
36
38
|
def __init__(self, uploader: AsyncUploader, workers_count: int) -> None:
|
37
39
|
self.manager = multiprocessing.Manager()
|
@@ -98,7 +100,7 @@ class AsyncDownloader(object):
|
|
98
100
|
continue
|
99
101
|
if not job.in_process:
|
100
102
|
if job.job_postponed_until > 0:
|
101
|
-
if job.job_postponed_until - time.time() > 0:
|
103
|
+
if (job.job_postponed_until - time.time()) > 0:
|
102
104
|
logging.warning("Job '%s' is postponed, rescheduling", job.url)
|
103
105
|
time.sleep(2)
|
104
106
|
self.job_queue.put(job)
|
@@ -169,7 +171,7 @@ class AsyncDownloader(object):
|
|
169
171
|
logging.warning("Telegram limits exceeded :(")
|
170
172
|
logging.exception(e)
|
171
173
|
self.send_message_to_admin(
|
172
|
-
f"Task <code>{job.job_id}</code> failed. URL: '{job.url}'. Reason: '<b>
|
174
|
+
f"Task <code>{job.job_id}</code> failed. URL: '{job.url}'. Reason: '<b>FileTooBig</b>'."
|
173
175
|
)
|
174
176
|
self.uploader.queue_task(job.to_upload_job(
|
175
177
|
job_failed=True,
|
@@ -222,9 +224,15 @@ class AsyncDownloader(object):
|
|
222
224
|
job_failed_msg="All bot accounts failed to download content. Bot administrator noticed about the issue.")
|
223
225
|
)
|
224
226
|
if e.job.job_origin == Origin.INSTAGRAM:
|
225
|
-
|
226
|
-
|
227
|
-
|
227
|
+
logging.info("Handling captcha postpone")
|
228
|
+
self.uploader.queue_task(job.to_upload_job(
|
229
|
+
job_warning=True,
|
230
|
+
job_warning_msg="Bot is experiencing issues, video delivery may be delayed.")
|
231
|
+
)
|
232
|
+
#self.try_next_account(selector, job, report_error="captcha")
|
233
|
+
#e.job.job_postponed_until = time.time() + 300
|
234
|
+
#self.job_queue.put(e.job)
|
235
|
+
self.fail_handler.store_failed_job(e.job)
|
228
236
|
break
|
229
237
|
except (UnknownError, Exception) as e:
|
230
238
|
logging.warning("UnknownError occurred!")
|
@@ -260,6 +268,9 @@ class AsyncDownloader(object):
|
|
260
268
|
break
|
261
269
|
|
262
270
|
if items:
|
271
|
+
# success
|
272
|
+
for job in self.fail_handler.get_failed_jobs():
|
273
|
+
self.queue_task(job)
|
263
274
|
for item in items:
|
264
275
|
media_info = {"filesize": 0}
|
265
276
|
if item["media_type"] == JobType.VIDEO:
|
@@ -0,0 +1,48 @@
|
|
1
|
+
import os
|
2
|
+
|
3
|
+
import pickle
|
4
|
+
from pymongo import MongoClient
|
5
|
+
|
6
|
+
from warp_beacon.jobs.download_job import DownloadJob
|
7
|
+
|
8
|
+
import logging
|
9
|
+
|
10
|
+
class FailHandler(object):
|
11
|
+
client = None
|
12
|
+
db = None
|
13
|
+
def __init__(self) -> None:
|
14
|
+
self.client = MongoClient(
|
15
|
+
host=os.environ.get("MONGODB_HOST", default='127.0.0.1'),
|
16
|
+
port=int(os.environ.get("MONGODB_PORT", default=27017)),
|
17
|
+
username=os.environ.get("MONGODB_USER", default='root'),
|
18
|
+
password=os.environ.get("MONGODB_PASSWORD", default="changeme"))
|
19
|
+
self.db = self.client.media.failed_jobs
|
20
|
+
|
21
|
+
def __del__(self) -> None:
|
22
|
+
if self.client:
|
23
|
+
self.client.close()
|
24
|
+
|
25
|
+
def store_failed_job(self, job: DownloadJob) -> int:
|
26
|
+
db_id = -1
|
27
|
+
try:
|
28
|
+
job_serilized = pickle.dumps(job)
|
29
|
+
db_id = self.db.insert_one(
|
30
|
+
{
|
31
|
+
"job_data": job_serilized
|
32
|
+
}).inserted_id
|
33
|
+
except Exception as e:
|
34
|
+
logging.error("Failed to store job as failed!")
|
35
|
+
logging.exception(e)
|
36
|
+
return db_id
|
37
|
+
|
38
|
+
def get_failed_jobs(self) -> list:
|
39
|
+
ret = []
|
40
|
+
try:
|
41
|
+
cursor = self.db.find()
|
42
|
+
for document in cursor:
|
43
|
+
ret.append(pickle.loads(document["job_data"]))
|
44
|
+
self.db.delete_many({})
|
45
|
+
except Exception as e:
|
46
|
+
logging.error("Failed to get failed jobs!")
|
47
|
+
logging.exception(e)
|
48
|
+
return ret
|
warp_beacon/telegram/utils.py
CHANGED
@@ -64,7 +64,7 @@ class Utils(object):
|
|
64
64
|
# expected url: https://www.instagram.com/share/reel/BAHtk2AamB
|
65
65
|
# result url: https://www.instagram.com/reel/DAKjQgUNzuH/
|
66
66
|
try:
|
67
|
-
if "instagram.com/" in url and "share" in url
|
67
|
+
if "instagram.com/" in url and "share/" in url:
|
68
68
|
content = requests.get(url).text
|
69
69
|
res = re.search(Utils.canonical_link_resolve_re, content)
|
70
70
|
new_url = res.group(1).strip()
|
@@ -3,7 +3,7 @@ lib/systemd/system/warp_beacon.service,sha256=lPmHqLqcI2eIV7nwHS0qcALQrznixqJuww
|
|
3
3
|
var/warp_beacon/accounts.json,sha256=2QQMS9N_Z-TnfZq4U1vSUe4IKyZGmTFdgo8BoF4hQ7E,1710
|
4
4
|
var/warp_beacon/placeholder.gif,sha256=cE5CGJVaop4Sx21zx6j4AyoHU0ncmvQuS2o6hJfEH88,6064
|
5
5
|
warp_beacon/__init__.py,sha256=_rThNODmz0nDp_n4mWo_HKaNFE5jk1_7cRhHyYaencI,163
|
6
|
-
warp_beacon/__version__.py,sha256=
|
6
|
+
warp_beacon/__version__.py,sha256=EqSmisKQYEBahR8JvUza2yMGiptpIUkXrqj8nNwfm_g,24
|
7
7
|
warp_beacon/warp_beacon.py,sha256=7KEtZDj-pdhtl6m-zFLsSojs1ZR4o7L0xbqtdmYPvfE,342
|
8
8
|
warp_beacon/compress/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
9
|
warp_beacon/compress/video.py,sha256=_PDMVYCyzLYxHv1uZmmzGcG_8rjaZr7BTXsXTTy_oS4,2846
|
@@ -19,10 +19,11 @@ warp_beacon/mediainfo/silencer.py,sha256=MgUc9Ibbhjhg9GbJMNfJqrdDkMsQShZkQ1sCwvW
|
|
19
19
|
warp_beacon/mediainfo/video.py,sha256=UBZrhTN5IDI-aYu6tsJEILo9nFkjHhkldGVFmvV7tEI,2480
|
20
20
|
warp_beacon/scheduler/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
21
21
|
warp_beacon/scheduler/scheduler.py,sha256=F9jF6myIHOI0TmC0-rBt2Un8gVvuhBW9zL-nEAEj0Bc,2585
|
22
|
-
warp_beacon/scraper/__init__.py,sha256=
|
22
|
+
warp_beacon/scraper/__init__.py,sha256=8Qm7H49WYe-_6uhX6fJswP3l-brFDBpzhwP4dR17L10,16431
|
23
23
|
warp_beacon/scraper/abstract.py,sha256=aNZ9ypF9B8BjflcIwi-7wEzIqF-XPeF0xvfX9CP_iIw,2708
|
24
24
|
warp_beacon/scraper/account_selector.py,sha256=YUzLxfGGBvdTR9sJVcx9SDkYK4tWo3iRkGiPIg6IRn4,3649
|
25
25
|
warp_beacon/scraper/exceptions.py,sha256=fHywTm2-y2RkgM6hVz12CkDMBgHcEoN2a1TBLaVM2t4,1300
|
26
|
+
warp_beacon/scraper/fail_handler.py,sha256=6bgQOi6NmE09S-bAbXbD56x_RW9ZsIUS89JJIJWpNQI,1210
|
26
27
|
warp_beacon/scraper/instagram/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
27
28
|
warp_beacon/scraper/instagram/instagram.py,sha256=m2bAqLu-_HchlF5CVZDlytB9cFGxrN7EEbQW-G1f5u4,12857
|
28
29
|
warp_beacon/scraper/youtube/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -35,11 +36,11 @@ warp_beacon/telegram/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hS
|
|
35
36
|
warp_beacon/telegram/bot.py,sha256=MONqsxLMJk3jnLFpn1Nfj5w-FSxPNS2Fx9QfaK2S5lw,15446
|
36
37
|
warp_beacon/telegram/handlers.py,sha256=171BUNjcaqTM1QnJ9KTBzuJOX1tiDys0hnyuAkA1NiI,7262
|
37
38
|
warp_beacon/telegram/placeholder_message.py,sha256=N1fSL1xbFLF5alhnEvk-xbf3v2A_nLWg6xHtVZTaoiA,6396
|
38
|
-
warp_beacon/telegram/utils.py,sha256=
|
39
|
+
warp_beacon/telegram/utils.py,sha256=9rNC1BqMZm-kKbzVonBOV8MYfMbcO68Bavq-K3Yj2KA,3115
|
39
40
|
warp_beacon/uploader/__init__.py,sha256=rbfsm_eYcfsBRkiaG0glVgBNtQCEe7cVQTWEIAHz5aw,4763
|
40
|
-
warp_beacon-2.2.
|
41
|
-
warp_beacon-2.2.
|
42
|
-
warp_beacon-2.2.
|
43
|
-
warp_beacon-2.2.
|
44
|
-
warp_beacon-2.2.
|
45
|
-
warp_beacon-2.2.
|
41
|
+
warp_beacon-2.2.63.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
42
|
+
warp_beacon-2.2.63.dist-info/METADATA,sha256=VSO-YcMRLe3O1fpEgrElKgLpBNbAsvbvCL2JWIjtXY8,21303
|
43
|
+
warp_beacon-2.2.63.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
44
|
+
warp_beacon-2.2.63.dist-info/entry_points.txt,sha256=eSB61Rb89d56WY0O-vEIQwkn18J-4CMrJcLA_R_8h3g,119
|
45
|
+
warp_beacon-2.2.63.dist-info/top_level.txt,sha256=UE5bi4kftU24IJgHm6BHcXiXAd1gUbD20nWmM6DG8yQ,1004
|
46
|
+
warp_beacon-2.2.63.dist-info/RECORD,,
|
@@ -17,6 +17,7 @@ warp_beacon/scraper
|
|
17
17
|
warp_beacon/scraper/abstract
|
18
18
|
warp_beacon/scraper/account_selector
|
19
19
|
warp_beacon/scraper/exceptions
|
20
|
+
warp_beacon/scraper/fail_handler
|
20
21
|
warp_beacon/scraper/instagram
|
21
22
|
warp_beacon/scraper/instagram/instagram
|
22
23
|
warp_beacon/scraper/types
|
File without changes
|
File without changes
|
File without changes
|