Обновить universal.py
This commit is contained in:
+7
-5
@@ -52,7 +52,8 @@ class SocialDownloaderMod(loader.Module):
|
|||||||
video_path, info = await self.download_video(args, source)
|
video_path, info = await self.download_video(args, source)
|
||||||
|
|
||||||
if not video_path:
|
if not video_path:
|
||||||
await status.edit("❌ Не удалось скачать видео")
|
err_msg = info if isinstance(info, str) else "Неизвестная ошибка"
|
||||||
|
await status.edit(f"❌ Не удалось скачать видео:\n<code>{utils.escape_html(err_msg)}</code>")
|
||||||
return
|
return
|
||||||
|
|
||||||
caption = f"<b>📹 Видео с {source}</b>\n\n"
|
caption = f"<b>📹 Видео с {source}</b>\n\n"
|
||||||
@@ -121,7 +122,7 @@ class SocialDownloaderMod(loader.Module):
|
|||||||
stdout, stderr = await process.communicate()
|
stdout, stderr = await process.communicate()
|
||||||
|
|
||||||
if process.returncode != 0:
|
if process.returncode != 0:
|
||||||
return None, {}
|
return None, stderr.decode('utf-8', errors='ignore')
|
||||||
|
|
||||||
for file in os.listdir(temp_dir):
|
for file in os.listdir(temp_dir):
|
||||||
file_path = os.path.join(temp_dir, file)
|
file_path = os.path.join(temp_dir, file)
|
||||||
@@ -132,11 +133,11 @@ class SocialDownloaderMod(loader.Module):
|
|||||||
info = await self.get_video_info(url)
|
info = await self.get_video_info(url)
|
||||||
return final_path, info
|
return final_path, info
|
||||||
|
|
||||||
return None, {}
|
return None, "Файл не найден после скачивания"
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Download error: {e}")
|
print(f"Download error: {e}")
|
||||||
return None, {}
|
return None, str(e)
|
||||||
|
|
||||||
async def get_video_info(self, url):
|
async def get_video_info(self, url):
|
||||||
try:
|
try:
|
||||||
@@ -209,7 +210,8 @@ class SocialDownloaderMod(loader.Module):
|
|||||||
stdout, stderr = await process.communicate()
|
stdout, stderr = await process.communicate()
|
||||||
|
|
||||||
if process.returncode != 0:
|
if process.returncode != 0:
|
||||||
await utils.answer(message, "❌ Ошибка скачивания")
|
err_msg = stderr.decode('utf-8', errors='ignore')
|
||||||
|
await utils.answer(message, f"❌ Ошибка скачивания:\n<code>{utils.escape_html(err_msg)}</code>")
|
||||||
return
|
return
|
||||||
|
|
||||||
for file in os.listdir(temp_dir):
|
for file in os.listdir(temp_dir):
|
||||||
|
|||||||
Reference in New Issue
Block a user