From 98906170981cc6f1ea757c7974cb43bfd383285d Mon Sep 17 00:00:00 2001 From: Jesus E Date: Sun, 28 May 2023 20:44:30 -0400 Subject: Fix fmt extraction mime_type regex failure as well as exceptions --- youtube/yt_data_extract/watch_extraction.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'youtube') diff --git a/youtube/yt_data_extract/watch_extraction.py b/youtube/yt_data_extract/watch_extraction.py index a3dfebf..d8413ea 100644 --- a/youtube/yt_data_extract/watch_extraction.py +++ b/youtube/yt_data_extract/watch_extraction.py @@ -400,14 +400,16 @@ def update_format_with_codec_info(fmt, codec): print('Warning: unrecognized codec: ' + codec) fmt_type_re = re.compile( - r'(text|audio|video)/([\w0-9]+); codecs="([\w0-9\.]+(?:, [\w0-9\.]+)*)"') + r'(text|audio|video)/([\w0-9]+); codecs="([^"]+)"') def update_format_with_type_info(fmt, yt_fmt): # 'type' for invidious api format mime_type = multi_get(yt_fmt, 'mimeType', 'type') if mime_type is None: return match = re.fullmatch(fmt_type_re, mime_type) - + if match is None: + print('Warning: Could not read mimetype', mime_type) + return type, fmt['ext'], codecs = match.groups() codecs = codecs.split(', ') for codec in codecs: -- cgit v1.2.3