Обновить universal.py

This commit is contained in:
yanistyle
2026-09-01 02:51:24 +03:00
parent ad481396e9
commit 4c30612e81
+6 -4
View File
@@ -113,9 +113,9 @@ class SocialDownloaderMod(loader.Module):
] ]
if source.lower() == 'tiktok': if source.lower() == 'tiktok':
cmd.extend(['--cookies', 'tiktok_cookies.txt', '--impersonate', 'Chrome']) cmd.extend(['--cookies', 'tiktok_cookies.txt'])
elif source.lower() == 'instagram': elif source.lower() == 'instagram':
cmd.extend(['--cookies', 'instagram_cookies.txt', '--impersonate', 'Chrome']) cmd.extend(['--cookies', 'instagram_cookies.txt'])
process = await asyncio.create_subprocess_exec( process = await asyncio.create_subprocess_exec(
*cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE *cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
@@ -142,7 +142,7 @@ class SocialDownloaderMod(loader.Module):
async def get_video_info(self, url): async def get_video_info(self, url):
try: try:
cmd = [sys.executable, '-m', 'yt_dlp', '--dump-json', '--no-playlist', '--impersonate', 'Chrome', url] cmd = [sys.executable, '-m', 'yt_dlp', '--dump-json', '--no-playlist', url]
process = await asyncio.create_subprocess_exec( process = await asyncio.create_subprocess_exec(
*cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE *cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
) )
@@ -197,9 +197,11 @@ class SocialDownloaderMod(loader.Module):
with tempfile.TemporaryDirectory() as temp_dir: with tempfile.TemporaryDirectory() as temp_dir:
output_template = os.path.join(temp_dir, '%(title)s.%(ext)s') output_template = os.path.join(temp_dir, '%(title)s.%(ext)s')
format_str = f'bestvideo[height<={quality}]+bestaudio/best[height<={quality}]/best' if quality != 'best' else 'bestvideo+bestaudio/best'
cmd = [ cmd = [
sys.executable, '-m', 'yt_dlp', sys.executable, '-m', 'yt_dlp',
'-f', f'best[height<={quality}]' if quality != 'best' else 'best', '-f', format_str,
'--max-filesize', f"{self.config['max_size']}M", '--max-filesize', f"{self.config['max_size']}M",
'-o', output_template, '-o', output_template,
url url