]> Raphaƫl G. Git Repositories - youtubedl/blobdiff - youtube_dl/extractor/discoverygo.py
d/rules: Drop makefile mangling
[youtubedl] / youtube_dl / extractor / discoverygo.py
index 3368c4c075505df8a4ff03198d66a33a76f5b2f6..9e7b14a7d594e5fbb145aab0521bc4f8250305a6 100644 (file)
@@ -3,7 +3,6 @@ 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 (
     determine_ext,
     extract_attributes,
 from ..utils import (
     determine_ext,
     extract_attributes,
@@ -12,6 +11,7 @@ from ..utils import (
     parse_age_limit,
     remove_end,
     unescapeHTML,
     parse_age_limit,
     remove_end,
     unescapeHTML,
+    url_or_none,
 )
 
 
 )
 
 
@@ -69,9 +69,8 @@ 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')
                 ext = determine_ext(subtitle_url)
                     continue
                 lang = caption.get('fileLang', 'en')
                 ext = determine_ext(subtitle_url)