aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/yt_data_extract/watch_extraction.py
diff options
context:
space:
mode:
authorJesus E <heckyel@riseup.net>2023-05-28 20:44:30 -0400
committerJesus E <heckyel@riseup.net>2023-05-28 20:44:30 -0400
commit98906170981cc6f1ea757c7974cb43bfd383285d (patch)
treee281f57ac44b06ee937be2de71e1c696f9d6a7c6 /youtube/yt_data_extract/watch_extraction.py
parentbeca545951f600e319ce5475d92c15c94c09c8d8 (diff)
downloadyt-local-98906170981cc6f1ea757c7974cb43bfd383285d.tar.lz
yt-local-98906170981cc6f1ea757c7974cb43bfd383285d.tar.xz
yt-local-98906170981cc6f1ea757c7974cb43bfd383285d.zip
Fix fmt extraction mime_type regex failure as well as exceptions
Diffstat (limited to 'youtube/yt_data_extract/watch_extraction.py')
-rw-r--r--youtube/yt_data_extract/watch_extraction.py6
1 files changed, 4 insertions, 2 deletions
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: