projects
/
youtube-dl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Start moving to ytdl-org
[youtube-dl]
/
youtube_dl
/
extractor
/
discoverygo.py
diff --git
a/youtube_dl/extractor/discoverygo.py
b/youtube_dl/extractor/discoverygo.py
index 99376454b2c79d61c3e53a51be2b5a4be9611f10..9e7b14a7d594e5fbb145aab0521bc4f8250305a6 100644
(file)
--- a/
youtube_dl/extractor/discoverygo.py
+++ b/
youtube_dl/extractor/discoverygo.py
@@
-3,14
+3,15
@@
from __future__ import unicode_literals
import re
from .common import InfoExtractor
import re
from .common import InfoExtractor
-from ..compat import compat_str
from ..utils import (
from ..utils import (
+ determine_ext,
extract_attributes,
ExtractorError,
int_or_none,
parse_age_limit,
remove_end,
unescapeHTML,
extract_attributes,
ExtractorError,
int_or_none,
parse_age_limit,
remove_end,
unescapeHTML,
+ url_or_none,
)
)
@@
-68,12
+69,15
@@
class DiscoveryGoBaseIE(InfoExtractor):
captions = stream.get('captions')
if isinstance(captions, list):
for caption in captions:
captions = stream.get('captions')
if isinstance(captions, list):
for caption in captions:
- subtitle_url = caption.get('fileUrl')
- if (not subtitle_url or not isinstance(subtitle_url, compat_str) or
- not subtitle_url.startswith('http')):
+ subtitle_url = url_or_none(caption.get('fileUrl'))
+ if not subtitle_url or not subtitle_url.startswith('http'):
continue
lang = caption.get('fileLang', 'en')
continue
lang = caption.get('fileLang', 'en')
- subtitles.setdefault(lang, []).append({'url': subtitle_url})
+ ext = determine_ext(subtitle_url)
+ subtitles.setdefault(lang, []).append({
+ 'url': subtitle_url,
+ 'ext': 'ttml' if ext == 'xml' else ext,
+ })
return {
'id': video_id,
return {
'id': video_id,