Обновить universal.py
This commit is contained in:
+5
-4
@@ -1,4 +1,4 @@
|
|||||||
# meta developer: @origsama
|
# meta developer: @HoroshoVse
|
||||||
# requires: yt-dlp
|
# requires: yt-dlp
|
||||||
from .. import loader, utils
|
from .. import loader, utils
|
||||||
import requests
|
import requests
|
||||||
@@ -9,6 +9,7 @@ import tempfile
|
|||||||
import urllib.parse
|
import urllib.parse
|
||||||
import json
|
import json
|
||||||
import shutil
|
import shutil
|
||||||
|
import sys
|
||||||
|
|
||||||
@loader.tds
|
@loader.tds
|
||||||
class SocialDownloaderMod(loader.Module):
|
class SocialDownloaderMod(loader.Module):
|
||||||
@@ -104,7 +105,7 @@ class SocialDownloaderMod(loader.Module):
|
|||||||
output_template = os.path.join(temp_dir, '%(title)s.%(ext)s')
|
output_template = os.path.join(temp_dir, '%(title)s.%(ext)s')
|
||||||
|
|
||||||
cmd = [
|
cmd = [
|
||||||
'yt-dlp',
|
sys.executable, '-m', 'yt_dlp',
|
||||||
'-f', 'best[filesize<50M]',
|
'-f', 'best[filesize<50M]',
|
||||||
'--max-filesize', f"{self.config['max_size']}M",
|
'--max-filesize', f"{self.config['max_size']}M",
|
||||||
'-o', output_template,
|
'-o', output_template,
|
||||||
@@ -141,7 +142,7 @@ class SocialDownloaderMod(loader.Module):
|
|||||||
|
|
||||||
async def get_video_info(self, url):
|
async def get_video_info(self, url):
|
||||||
try:
|
try:
|
||||||
cmd = ['yt-dlp', '--dump-json', '--no-playlist', 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,7 +198,7 @@ class SocialDownloaderMod(loader.Module):
|
|||||||
output_template = os.path.join(temp_dir, '%(title)s.%(ext)s')
|
output_template = os.path.join(temp_dir, '%(title)s.%(ext)s')
|
||||||
|
|
||||||
cmd = [
|
cmd = [
|
||||||
'yt-dlp',
|
sys.executable, '-m', 'yt_dlp',
|
||||||
'-f', f'best[height<={quality}]' if quality != 'best' else 'best',
|
'-f', f'best[height<={quality}]' if quality != 'best' else 'best',
|
||||||
'--max-filesize', f"{self.config['max_size']}M",
|
'--max-filesize', f"{self.config['max_size']}M",
|
||||||
'-o', output_template,
|
'-o', output_template,
|
||||||
|
|||||||
Reference in New Issue
Block a user