diff options
author | remitamine <remitamine@gmail.com> | 2016-02-20 22:02:03 +0100 |
---|---|---|
committer | remitamine <remitamine@gmail.com> | 2016-02-20 22:02:03 +0100 |
commit | cafcf657a4e16f0bcf90195f8e35bfcce7faad8e (patch) | |
tree | d4b4ffd697459393f72b952a98afdc7495031776 /youtube_dl/extractor | |
parent | 7360db05b43741c2dfa1fd024e9c2f013ed97c9e (diff) |
add more subtitles mime types to mimetype2ext and fix the platform subtitle extraction
Diffstat (limited to 'youtube_dl/extractor')
-rw-r--r-- | youtube_dl/extractor/common.py | 12 | ||||
-rw-r--r-- | youtube_dl/extractor/theplatform.py | 3 |
2 files changed, 4 insertions, 11 deletions
diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py index f411ea763..c85dcda0c 100644 --- a/youtube_dl/extractor/common.py +++ b/youtube_dl/extractor/common.py @@ -46,6 +46,7 @@ from ..utils import ( xpath_with_ns, determine_protocol, parse_duration, + mimetype2ext, ) @@ -1277,16 +1278,7 @@ class InfoExtractor(object): if not src or src in urls: continue urls.append(src) - ext = textstream.get('ext') or determine_ext(src) - if not ext: - type_ = textstream.get('type') - SUBTITLES_TYPES = { - 'text/vtt': 'vtt', - 'text/srt': 'srt', - 'application/smptett+xml': 'tt', - } - if type_ in SUBTITLES_TYPES: - ext = SUBTITLES_TYPES[type_] + ext = textstream.get('ext') or determine_ext(src) or mimetype2ext(textstream.get('type')) lang = textstream.get('systemLanguage') or textstream.get('systemLanguageName') or textstream.get('lang') or subtitles_lang subtitles.setdefault(lang, []).append({ 'url': src, diff --git a/youtube_dl/extractor/theplatform.py b/youtube_dl/extractor/theplatform.py index 755f816ff..93d871571 100644 --- a/youtube_dl/extractor/theplatform.py +++ b/youtube_dl/extractor/theplatform.py @@ -21,6 +21,7 @@ from ..utils import ( sanitized_Request, unsmuggle_url, xpath_with_ns, + mimetype2ext, ) default_ns = 'http://www.w3.org/2005/SMIL21/Language' @@ -68,7 +69,7 @@ class ThePlatformBaseIE(InfoExtractor): for caption in captions: lang, src, mime = caption.get('lang', 'en'), caption.get('src'), caption.get('type') subtitles[lang] = [{ - 'ext': 'srt' if mime == 'text/srt' else 'ttml', + 'ext': mimetype2ext(mime), 'url': src, }] |