warp-beacon 2.2.47__py3-none-any.whl → 2.2.48__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 +9 -9
- warp_beacon/scraper/youtube/abstract.py +2 -2
- warp_beacon/telegram/bot.py +10 -8
- warp_beacon/telegram/handlers.py +2 -1
- warp_beacon/telegram/placeholder_message.py +9 -9
- warp_beacon/telegram/utils.py +1 -29
- {warp_beacon-2.2.47.dist-info → warp_beacon-2.2.48.dist-info}/METADATA +1 -1
- {warp_beacon-2.2.47.dist-info → warp_beacon-2.2.48.dist-info}/RECORD +13 -13
- {warp_beacon-2.2.47.dist-info → warp_beacon-2.2.48.dist-info}/LICENSE +0 -0
- {warp_beacon-2.2.47.dist-info → warp_beacon-2.2.48.dist-info}/WHEEL +0 -0
- {warp_beacon-2.2.47.dist-info → warp_beacon-2.2.48.dist-info}/entry_points.txt +0 -0
- {warp_beacon-2.2.47.dist-info → warp_beacon-2.2.48.dist-info}/top_level.txt +0 -0
warp_beacon/__version__.py
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
__version__ = "2.2.
|
1
|
+
__version__ = "2.2.48"
|
2
2
|
|
warp_beacon/scraper/__init__.py
CHANGED
@@ -133,7 +133,7 @@ class AsyncDownloader(object):
|
|
133
133
|
logging.warning("Not found error occurred!")
|
134
134
|
logging.exception(e)
|
135
135
|
self.send_message_to_admin(
|
136
|
-
f"Task
|
136
|
+
f"Task <code>{job.job_id}</code> failed. URL: {job.url}'. Reason: '<b>NotFound</b>'."
|
137
137
|
)
|
138
138
|
self.uploader.queue_task(job.to_upload_job(
|
139
139
|
job_failed=True,
|
@@ -158,7 +158,7 @@ class AsyncDownloader(object):
|
|
158
158
|
logging.warning("Timeout error occurred!")
|
159
159
|
logging.exception(e)
|
160
160
|
self.send_message_to_admin(
|
161
|
-
f"Task
|
161
|
+
f"Task <code>{job.job_id}</code> failed. URL: '{job.url}'. Reason: '<b>TimeOut</b>'."
|
162
162
|
)
|
163
163
|
self.uploader.queue_task(job.to_upload_job(
|
164
164
|
job_failed=True,
|
@@ -169,7 +169,7 @@ class AsyncDownloader(object):
|
|
169
169
|
logging.warning("Telegram limits exceeded :(")
|
170
170
|
logging.exception(e)
|
171
171
|
self.send_message_to_admin(
|
172
|
-
f"Task
|
172
|
+
f"Task <code>{job.job_id}</code> failed. URL: '{job.url}'. Reason: '<b>FileTooBi</b>'."
|
173
173
|
)
|
174
174
|
self.uploader.queue_task(job.to_upload_job(
|
175
175
|
job_failed=True,
|
@@ -208,14 +208,14 @@ class AsyncDownloader(object):
|
|
208
208
|
job_failed_msg="Youtube Age Restricted error. Check your bot Youtube account settings.")
|
209
209
|
)
|
210
210
|
self.send_message_to_admin(
|
211
|
-
f"Task
|
211
|
+
f"Task <code>{job.job_id}</code> failed. URL: '{job.url}'. Reason: '<b>YotubeAgeRestrictedError</b>'."
|
212
212
|
)
|
213
213
|
break
|
214
214
|
except AllAccountsFailed as e:
|
215
215
|
logging.error("All accounts failed!")
|
216
216
|
logging.exception(e)
|
217
217
|
self.send_message_to_admin(
|
218
|
-
f"Task
|
218
|
+
f"Task <code>{e.job.job_id}</code> failed. URL: '{e.job.url}'. Reason: '<b>AllAccountsFailed</b>'."
|
219
219
|
)
|
220
220
|
self.uploader.queue_task(e.job.to_upload_job(
|
221
221
|
job_failed=True,
|
@@ -237,7 +237,7 @@ class AsyncDownloader(object):
|
|
237
237
|
if "geoblock_required" in exception_msg:
|
238
238
|
if job.geoblock_error_count > self.acc_selector.count_service_accounts(job.job_origin):
|
239
239
|
self.send_message_to_admin(
|
240
|
-
f"Task
|
240
|
+
f"Task <code>{job.job_id}</code> failed. URL: '{job.url}'. Reason: '<b>geoblock_required</b>'."
|
241
241
|
)
|
242
242
|
self.uploader.queue_task(job.to_upload_job(
|
243
243
|
job_failed=True,
|
@@ -250,12 +250,12 @@ class AsyncDownloader(object):
|
|
250
250
|
self.job_queue.put(job)
|
251
251
|
break
|
252
252
|
self.send_message_to_admin(
|
253
|
-
f"Task
|
254
|
-
f"Exception:\n
|
253
|
+
f"Task <code>{job.job_id}</code> failed. URL: '{job.url}'. Reason: '<b>UnknownError</b>'."
|
254
|
+
f"Exception:\n<pre code=\"python\">\n{exception_msg}\n</pre>"
|
255
255
|
)
|
256
256
|
self.uploader.queue_task(job.to_upload_job(
|
257
257
|
job_failed=True,
|
258
|
-
job_failed_msg="WOW, unknown error occured! Please
|
258
|
+
job_failed_msg="WOW, unknown error occured! Please <a href=\"https://github.com/sb0y/warp_beacon/issues\">create issue</a> with service logs.")
|
259
259
|
)
|
260
260
|
break
|
261
261
|
|
@@ -47,9 +47,9 @@ def patched_fetch_bearer_token(self) -> None:
|
|
47
47
|
|
48
48
|
logging.warning("Please open %s and input code '%s'", verification_url, user_code)
|
49
49
|
self.send_message_to_admin_func(
|
50
|
-
f"Please open {verification_url} and input code
|
50
|
+
f"Please open {verification_url} and input code <code>{user_code}</code>.\n\n"
|
51
51
|
"Please select a Google account with verified age.\n"
|
52
|
-
"This will allow you to avoid error the
|
52
|
+
"This will allow you to avoid error the <b>AgeRestrictedError</b> when accessing some content.",
|
53
53
|
account_admins=self.wb_account.get("account_admins", None),
|
54
54
|
yt_auth=True)
|
55
55
|
self.auth_event.wait()
|
warp_beacon/telegram/bot.py
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
-
import os
|
1
|
+
import os
|
2
2
|
import signal
|
3
3
|
|
4
|
+
import html
|
5
|
+
|
4
6
|
import uvloop
|
5
7
|
|
6
8
|
from pyrogram import Client, filters
|
@@ -108,7 +110,7 @@ class Bot(object):
|
|
108
110
|
message_reply = await self.client.send_message(
|
109
111
|
chat_id=chat_id,
|
110
112
|
text=text,
|
111
|
-
parse_mode=ParseMode.
|
113
|
+
parse_mode=ParseMode.HTML,
|
112
114
|
reply_to_message_id=reply_id
|
113
115
|
)
|
114
116
|
return message_reply.id
|
@@ -132,7 +134,7 @@ class Bot(object):
|
|
132
134
|
admins_array = admins.split(',')
|
133
135
|
for adm in admins_array:
|
134
136
|
adm = adm.strip()
|
135
|
-
msg_opts = {"chat_id": adm, "text": text, "parse_mode": ParseMode.
|
137
|
+
msg_opts = {"chat_id": adm, "text": text, "parse_mode": ParseMode.HTML}
|
136
138
|
if yt_auth:
|
137
139
|
msg_opts["reply_markup"] = InlineKeyboardMarkup(
|
138
140
|
[
|
@@ -153,16 +155,16 @@ class Bot(object):
|
|
153
155
|
def build_signature_caption(self, job: UploadJob) -> str:
|
154
156
|
caption = ""
|
155
157
|
if job.canonical_name:
|
156
|
-
caption = f"
|
158
|
+
caption = f"<b>{html.escape(job.canonical_name)}</b>"
|
157
159
|
if job.chat_type in (ChatType.GROUP, ChatType.SUPERGROUP):
|
158
160
|
if job.canonical_name:
|
159
161
|
caption += "\n—\n"
|
160
162
|
if job.source_username:
|
161
|
-
caption += f"Requested by
|
163
|
+
caption += f"Requested by <b>@{job.source_username}</b>"
|
162
164
|
if job.source_username and job.url:
|
163
165
|
caption += " | "
|
164
166
|
if job.url:
|
165
|
-
caption += f"
|
167
|
+
caption += f'<a href="{job.url}">source link</a>'
|
166
168
|
|
167
169
|
return caption
|
168
170
|
|
@@ -408,8 +410,8 @@ class Bot(object):
|
|
408
410
|
if hasattr(e, "MESSAGE") and e.MESSAGE:
|
409
411
|
msg = f"Telegram error: {str(e.MESSAGE)}"
|
410
412
|
else:
|
411
|
-
msg = (f"Unknown Telegram error. Known information:\n
|
412
|
-
"\nPlease
|
413
|
+
msg = (f"Unknown Telegram error. Known information:\n<pre language=\"python\">\n{traceback.format_exc().strip()}</pre>"
|
414
|
+
"\nPlease <a href=\"https://github.com/sb0y/warp_beacon/issues\">create issue</a> with this info and service logs.")
|
413
415
|
await self.placeholder.remove(job.chat_id, job.placeholder_message_id)
|
414
416
|
await self.send_text(job.chat_id, msg, job.message_id)
|
415
417
|
break
|
warp_beacon/telegram/handlers.py
CHANGED
@@ -26,6 +26,7 @@ class Handlers(object):
|
|
26
26
|
async def help(self, client: Client, message: Message) -> None:
|
27
27
|
"""Send a message when the command /help is issued."""
|
28
28
|
await self.bot.send_text(text="Send me a link to remote media", reply_id=message.id, chat_id=message.chat.id)
|
29
|
+
#await message.reply_text("<code>test</code>\n<b>bold</b>\n<pre code=\"python\">print('hello')</pre> @BelisariusCawl", parse_mode=ParseMode.HTML)
|
29
30
|
|
30
31
|
async def random(self, client: Client, message: Message) -> None:
|
31
32
|
d = self.storage.get_random()
|
@@ -51,7 +52,7 @@ class Handlers(object):
|
|
51
52
|
BotCommand("random", "Get random media")
|
52
53
|
])
|
53
54
|
await message.reply_text(
|
54
|
-
parse_mode=ParseMode.
|
55
|
+
parse_mode=ParseMode.HTML,
|
55
56
|
text=f"Welcome to @{bot_name.username}!\n"
|
56
57
|
"Send link to external social network with content and I'll reply to it.\n"
|
57
58
|
"Currently supported: Instagram, YouTube Shorts and YouTube Music."
|
@@ -43,7 +43,7 @@ class PlaceholderMessage(object):
|
|
43
43
|
animation=self.placeholder.tg_file_id,
|
44
44
|
caption=text,
|
45
45
|
reply_to_message_id=reply_id,
|
46
|
-
parse_mode=ParseMode.
|
46
|
+
parse_mode=ParseMode.HTML
|
47
47
|
)
|
48
48
|
|
49
49
|
return reply
|
@@ -54,7 +54,7 @@ class PlaceholderMessage(object):
|
|
54
54
|
photo=self.placeholder.tg_file_id,
|
55
55
|
caption=text,
|
56
56
|
reply_to_message_id=reply_id,
|
57
|
-
parse_mode=ParseMode.
|
57
|
+
parse_mode=ParseMode.HTML
|
58
58
|
)
|
59
59
|
|
60
60
|
return reply
|
@@ -65,7 +65,7 @@ class PlaceholderMessage(object):
|
|
65
65
|
document=self.placeholder.tg_file_id,
|
66
66
|
caption=text,
|
67
67
|
reply_to_message_id=reply_id,
|
68
|
-
parse_mode=ParseMode.
|
68
|
+
parse_mode=ParseMode.HTMLCalendar(firstweekday=0)
|
69
69
|
)
|
70
70
|
|
71
71
|
return reply
|
@@ -75,7 +75,7 @@ class PlaceholderMessage(object):
|
|
75
75
|
max_retries = int(os.environ.get("TG_MAX_RETRIES", default=5))
|
76
76
|
while not retry_amount >= max_retries:
|
77
77
|
try:
|
78
|
-
text = "
|
78
|
+
text = "<b>Loading, this may take a moment ...</b> ⏱️ "
|
79
79
|
reply = None
|
80
80
|
if self.placeholder.tg_file_id is None:
|
81
81
|
ph_found = False
|
@@ -90,7 +90,7 @@ class PlaceholderMessage(object):
|
|
90
90
|
document=ph,
|
91
91
|
force_document=False,
|
92
92
|
caption=text,
|
93
|
-
parse_mode=ParseMode.
|
93
|
+
parse_mode=ParseMode.HTML,
|
94
94
|
reply_to_message_id=reply_id,
|
95
95
|
file_name=os.path.basename(ph),
|
96
96
|
#width=pl_resolution["width"],
|
@@ -111,7 +111,7 @@ class PlaceholderMessage(object):
|
|
111
111
|
animation="https://bagrintsev.me/warp_beacon/placeholder_that_we_deserve.mp4",
|
112
112
|
caption=text,
|
113
113
|
reply_to_message_id=reply_id,
|
114
|
-
parse_mode=ParseMode.
|
114
|
+
parse_mode=ParseMode.HTML
|
115
115
|
)
|
116
116
|
self.placeholder = PlaceHolder(PlaceholderType.ANIMATION, Utils.extract_file_id(reply))
|
117
117
|
except Exception as e:
|
@@ -120,7 +120,7 @@ class PlaceholderMessage(object):
|
|
120
120
|
img = self.create_default_placeholder_img("Loading, this may take a moment ...")
|
121
121
|
reply = await self.bot.client.send_photo(
|
122
122
|
chat_id=chat_id,
|
123
|
-
parse_mode=ParseMode.
|
123
|
+
parse_mode=ParseMode.HTML,
|
124
124
|
reply_to_message_id=reply_id,
|
125
125
|
photo=img
|
126
126
|
)
|
@@ -177,8 +177,8 @@ class PlaceholderMessage(object):
|
|
177
177
|
await self.bot.client.edit_message_caption(
|
178
178
|
chat_id=chat_id,
|
179
179
|
message_id=placeholder_message_id,
|
180
|
-
caption=" ⚠️
|
181
|
-
parse_mode=ParseMode.
|
180
|
+
caption=" ⚠️ <b>%s</b>" % placeholder_text,
|
181
|
+
parse_mode=ParseMode.HTML
|
182
182
|
)
|
183
183
|
except Exception as e:
|
184
184
|
logging.error("Failed to update placeholder message!")
|
warp_beacon/telegram/utils.py
CHANGED
@@ -93,32 +93,4 @@ class Utils(object):
|
|
93
93
|
return message.sender_chat.username
|
94
94
|
if message.sender_chat.title:
|
95
95
|
return message.sender_chat.title
|
96
|
-
return ''
|
97
|
-
|
98
|
-
@staticmethod
|
99
|
-
def escape_markdown(text: str, version: int = 1, entity_type: str = None) -> str:
|
100
|
-
"""
|
101
|
-
Helper function to escape telegram markup symbols.
|
102
|
-
|
103
|
-
Args:
|
104
|
-
text (:obj:`str`): The text.
|
105
|
-
version (:obj:`int` | :obj:`str`): Use to specify the version of telegrams Markdown.
|
106
|
-
Either ``1`` or ``2``. Defaults to ``1``.
|
107
|
-
entity_type (:obj:`str`, optional): For the entity types ``PRE``, ``CODE`` and the link
|
108
|
-
part of ``TEXT_LINKS``, only certain characters need to be escaped in ``MarkdownV2``.
|
109
|
-
See the official API documentation for details. Only valid in combination with
|
110
|
-
``version=2``, will be ignored else.
|
111
|
-
"""
|
112
|
-
if int(version) == 1:
|
113
|
-
escape_chars = r'_*`['
|
114
|
-
elif int(version) == 2:
|
115
|
-
if entity_type in ['pre', 'code']:
|
116
|
-
escape_chars = r'\`'
|
117
|
-
elif entity_type == 'text_link':
|
118
|
-
escape_chars = r'\)'
|
119
|
-
else:
|
120
|
-
escape_chars = r'_*[]()~`>#+-=|{}.!'
|
121
|
-
else:
|
122
|
-
raise ValueError('Markdown version must be either 1 or 2!')
|
123
|
-
|
124
|
-
return re.sub(f'([{re.escape(escape_chars)}])', r'\\\\\1', text)
|
96
|
+
return ''
|
@@ -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=kwZwUmdEd7n4PzIqjrSJ5OgN-EIm9Fz-bsiTqy9r-As,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,27 +19,27 @@ warp_beacon/mediainfo/silencer.py,sha256=MgUc9Ibbhjhg9GbJMNfJqrdDkMsQShZkQ1sCwvW
|
|
19
19
|
warp_beacon/mediainfo/video.py,sha256=DXHiWAOyJPSVXQ0OP7uOBikUFT7noFmMaMSIx04Mhs4,2506
|
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=Nc-wdqu1KLLQkf3kkhl7jXzDWiv6vzKPudJdwL9sb24,15938
|
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
26
|
warp_beacon/scraper/instagram/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
27
27
|
warp_beacon/scraper/instagram/instagram.py,sha256=m2bAqLu-_HchlF5CVZDlytB9cFGxrN7EEbQW-G1f5u4,12857
|
28
28
|
warp_beacon/scraper/youtube/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
29
|
-
warp_beacon/scraper/youtube/abstract.py,sha256=
|
29
|
+
warp_beacon/scraper/youtube/abstract.py,sha256=ZLLbxKuYq4nwvDP7yL3zVYqP0p70IiQbYGhvXHoCzwM,7872
|
30
30
|
warp_beacon/scraper/youtube/music.py,sha256=nbTDFdgXGbTNqttE828DEgvSc8-SuAsQAHeqUwU6yFM,1484
|
31
31
|
warp_beacon/scraper/youtube/shorts.py,sha256=RqMYDq4XHChtp-LdlxXyHej4h3NI3Qi9T8USxwk-pIk,1177
|
32
32
|
warp_beacon/scraper/youtube/youtube.py,sha256=JvN5pVz0jtxCY9FGMl1dIg5Ccr2Kulaoxtym0Vb1QwQ,2224
|
33
33
|
warp_beacon/storage/__init__.py,sha256=m86MDXBMtZZsTPLI2cD-pM5Xkh2g2NYVvp_dtW8eH0Q,3548
|
34
34
|
warp_beacon/telegram/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
35
|
-
warp_beacon/telegram/bot.py,sha256=
|
36
|
-
warp_beacon/telegram/handlers.py,sha256=
|
37
|
-
warp_beacon/telegram/placeholder_message.py,sha256=
|
38
|
-
warp_beacon/telegram/utils.py,sha256=
|
35
|
+
warp_beacon/telegram/bot.py,sha256=MONqsxLMJk3jnLFpn1Nfj5w-FSxPNS2Fx9QfaK2S5lw,15446
|
36
|
+
warp_beacon/telegram/handlers.py,sha256=SyYSDYbHnMpXDqockHTN-8Rg_YimLDfJAOhuubQfyUo,7183
|
37
|
+
warp_beacon/telegram/placeholder_message.py,sha256=ToEwC7wG_WeJE8eYyEmhOtkXLhoUR-qE_jUNS510Z6c,6420
|
38
|
+
warp_beacon/telegram/utils.py,sha256=wSyJJsv1chaK4hqnBP-dDiY1hYD7wFhzBzw5H_AwE88,2450
|
39
39
|
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.
|
40
|
+
warp_beacon-2.2.48.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
41
|
+
warp_beacon-2.2.48.dist-info/METADATA,sha256=a4xEyrn7IctdbA90GRWJMEE_HQOpi97DDOuelFTBk2Y,21251
|
42
|
+
warp_beacon-2.2.48.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
|
43
|
+
warp_beacon-2.2.48.dist-info/entry_points.txt,sha256=eSB61Rb89d56WY0O-vEIQwkn18J-4CMrJcLA_R_8h3g,119
|
44
|
+
warp_beacon-2.2.48.dist-info/top_level.txt,sha256=ALb_Ft_eG-OY4_m0TWUifNUOZsrx483L-zw7G7vqXoc,971
|
45
|
+
warp_beacon-2.2.48.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|