aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/downloader
diff options
context:
space:
mode:
Diffstat (limited to 'yt_dlp/downloader')
-rw-r--r--yt_dlp/downloader/external.py13
-rw-r--r--yt_dlp/downloader/fragment.py5
-rw-r--r--yt_dlp/downloader/websocket.py7
3 files changed, 19 insertions, 6 deletions
diff --git a/yt_dlp/downloader/external.py b/yt_dlp/downloader/external.py
index 17be3c46f..f4fdcf120 100644
--- a/yt_dlp/downloader/external.py
+++ b/yt_dlp/downloader/external.py
@@ -17,11 +17,13 @@ from ..utils import (
cli_valueless_option,
cli_bool_option,
_configuration_args,
+ determine_ext,
encodeFilename,
encodeArgument,
handle_youtubedl_headers,
check_executable,
Popen,
+ remove_end,
)
@@ -304,7 +306,7 @@ class HttpieFD(ExternalFD):
@classmethod
def available(cls, path=None):
- return ExternalFD.available(cls, path or 'http')
+ return super().available(path or 'http')
def _make_cmd(self, tmpfilename, info_dict):
cmd = ['http', '--download', '--output', tmpfilename, info_dict['url']]
@@ -463,6 +465,15 @@ class FFmpegFD(ExternalFD):
args += ['-f', 'flv']
elif ext == 'mp4' and tmpfilename == '-':
args += ['-f', 'mpegts']
+ elif ext == 'unknown_video':
+ ext = determine_ext(remove_end(tmpfilename, '.part'))
+ if ext == 'unknown_video':
+ self.report_warning(
+ 'The video format is unknown and cannot be downloaded by ffmpeg. '
+ 'Explicitly set the extension in the filename to attempt download in that format')
+ else:
+ self.report_warning(f'The video format is unknown. Trying to download as {ext} according to the filename')
+ args += ['-f', EXT_TO_OUT_FORMATS.get(ext, ext)]
else:
args += ['-f', EXT_TO_OUT_FORMATS.get(ext, ext)]
diff --git a/yt_dlp/downloader/fragment.py b/yt_dlp/downloader/fragment.py
index d4f112b0f..19c0990d3 100644
--- a/yt_dlp/downloader/fragment.py
+++ b/yt_dlp/downloader/fragment.py
@@ -14,7 +14,7 @@ except ImportError:
from .common import FileDownloader
from .http import HttpFD
-from ..aes import aes_cbc_decrypt_bytes
+from ..aes import aes_cbc_decrypt_bytes, unpad_pkcs7
from ..compat import (
compat_os_name,
compat_urllib_error,
@@ -366,8 +366,7 @@ class FragmentFD(FileDownloader):
# not what it decrypts to.
if self.params.get('test', False):
return frag_content
- decrypted_data = aes_cbc_decrypt_bytes(frag_content, decrypt_info['KEY'], iv)
- return decrypted_data[:-decrypted_data[-1]]
+ return unpad_pkcs7(aes_cbc_decrypt_bytes(frag_content, decrypt_info['KEY'], iv))
return decrypt_fragment
diff --git a/yt_dlp/downloader/websocket.py b/yt_dlp/downloader/websocket.py
index 088222046..daac34884 100644
--- a/yt_dlp/downloader/websocket.py
+++ b/yt_dlp/downloader/websocket.py
@@ -5,9 +5,12 @@ import threading
try:
import websockets
- has_websockets = True
-except ImportError:
+except (ImportError, SyntaxError):
+ # websockets 3.10 on python 3.6 causes SyntaxError
+ # See https://github.com/yt-dlp/yt-dlp/issues/2633
has_websockets = False
+else:
+ has_websockets = True
from .common import FileDownloader
from .external import FFmpegFD