]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/condenast.py
[ie/crunchyroll] Fix stream extraction (#10005)
[yt-dlp.git] / yt_dlp / extractor / condenast.py
index d5e77af3216b215d9a11bce0fb788ef4a8c15fd9..3170c2990ea8da18fdef27e726bf9457c35d626a 100644 (file)
@@ -1,6 +1,3 @@
-# coding: utf-8
-from __future__ import unicode_literals
-
 import re
 
 from .common import InfoExtractor
@@ -61,7 +58,10 @@ class CondeNastIE(InfoExtractor):
         )''' % '|'.join(_SITES.keys())
     IE_DESC = 'Condé Nast media group: %s' % ', '.join(sorted(_SITES.values()))
 
-    EMBED_URL = r'(?:https?:)?//player(?:-backend)?\.(?:%s)\.com/(?:embed(?:js)?|(?:script|inline)/video)/.+?' % '|'.join(_SITES.keys())
+    _EMBED_REGEX = [r'''(?x)
+        <(?:iframe|script)[^>]+?src=(["\'])(?P<url>
+            (?:https?:)?//player(?:-backend)?\.(?:%s)\.com/(?:embed(?:js)?|(?:script|inline)/video)/.+?
+        )\1''' % '|'.join(_SITES.keys())]
 
     _TESTS = [{
         'url': 'http://video.wired.com/watch/3d-printed-speakers-lit-with-led',
@@ -197,7 +197,6 @@ def _extract_video(self, params):
                 'ext': ext,
                 'quality': 1 if quality == 'high' else 0,
             })
-        self._sort_formats(formats)
 
         subtitles = {}
         for t, caption in video_info.get('captions', {}).items():
@@ -222,7 +221,7 @@ def _extract_video(self, params):
         }
 
     def _real_extract(self, url):
-        video_id, player_id, target, url_type, display_id = re.match(self._VALID_URL, url).groups()
+        video_id, player_id, target, url_type, display_id = self._match_valid_url(url).groups()
 
         if video_id:
             return self._extract_video({