diff options
author | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-05-23 22:29:28 +0530 |
---|---|---|
committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-05-23 22:32:47 +0530 |
commit | 3907333c5db9a05ab37624fdcaa6ec3ed729f2aa (patch) | |
tree | b07b85d8c2d5cce5aef1a0b52d9686a8855391c9 | |
parent | acdecdfaef96cc97900c2421dd2cf4a00b2e999e (diff) | |
download | hypervideo-pre-3907333c5db9a05ab37624fdcaa6ec3ed729f2aa.tar.lz hypervideo-pre-3907333c5db9a05ab37624fdcaa6ec3ed729f2aa.tar.xz hypervideo-pre-3907333c5db9a05ab37624fdcaa6ec3ed729f2aa.zip |
[extractor] Skip subtitles without URI in m3u8 manifests
Closes #339
Authored by: hheimbuerger
-rw-r--r-- | yt_dlp/extractor/common.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py index ac2f59462..888cc8efa 100644 --- a/yt_dlp/extractor/common.py +++ b/yt_dlp/extractor/common.py @@ -2042,7 +2042,12 @@ class InfoExtractor(object): groups.setdefault(group_id, []).append(media) # <https://tools.ietf.org/html/rfc8216#section-4.3.4.1> if media_type == 'SUBTITLES': - lang = media['LANGUAGE'] # XXX: normalise? + # According to RFC 8216 ยง4.3.4.2.1, URI is REQUIRED in the + # EXT-X-MEDIA tag if the media type is SUBTITLES. + # However, lack of URI has been spotted in the wild. + # e.g. NebulaIE; see https://github.com/yt-dlp/yt-dlp/issues/339 + if not media.get('URI'): + return url = format_url(media['URI']) sub_info = { 'url': url, @@ -2054,6 +2059,7 @@ class InfoExtractor(object): # <https://tools.ietf.org/html/rfc8216#section-3.1> sub_info['ext'] = 'vtt' sub_info['protocol'] = 'm3u8_native' + lang = media.get('LANGUAGE') or 'unknown' subtitles.setdefault(lang, []).append(sub_info) if media_type not in ('VIDEO', 'AUDIO'): return |