]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/limelight.py
[extractors] Use new framework for existing embeds (#4307)
[yt-dlp.git] / yt_dlp / extractor / limelight.py
index d1f0edc6bd489cfd7eb51b463099b7c09a1e272b..90065094b60006641d72bffdc28f6ffea8d005b3 100644 (file)
@@ -1,6 +1,3 @@
-# coding: utf-8
-from __future__ import unicode_literals
-
 import re
 
 from .common import InfoExtractor
@@ -20,7 +17,7 @@ class LimelightBaseIE(InfoExtractor):
     _PLAYLIST_SERVICE_URL = 'http://production-ps.lvp.llnw.net/r/PlaylistService/%s/%s/%s'
 
     @classmethod
-    def _extract_urls(cls, webpage, source_url):
+    def _extract_embed_urls(cls, url, webpage):
         lm = {
             'Media': 'media',
             'Channel': 'channel',
@@ -28,7 +25,7 @@ def _extract_urls(cls, webpage, source_url):
         }
 
         def smuggle(url):
-            return smuggle_url(url, {'source_url': source_url})
+            return smuggle_url(url, {'source_url': url})
 
         entries = []
         for kind, video_id in re.findall(
@@ -98,7 +95,7 @@ def _extract_info(self, pc, mobile, i, referer):
             stream_url = stream.get('url')
             if not stream_url or stream_url in urls:
                 continue
-            if not self._downloader.params.get('allow_unplayable_formats') and stream.get('drmProtected'):
+            if not self.get_param('allow_unplayable_formats') and stream.get('drmProtected'):
                 continue
             urls.append(stream_url)
             ext = determine_ext(stream_url)
@@ -163,7 +160,7 @@ def _extract_info(self, pc, mobile, i, referer):
             if not media_url or media_url in urls:
                 continue
             if (format_id in ('Widevine', 'SmoothStreaming')
-                    and not self._downloader.params.get('allow_unplayable_formats', False)):
+                    and not self.get_param('allow_unplayable_formats', False)):
                 continue
             urls.append(media_url)
             ext = determine_ext(media_url)
@@ -194,7 +191,7 @@ def _extract_info(self, pc, mobile, i, referer):
                     cc_url = cc.get('webvttFileUrl')
                     if not cc_url:
                         continue
-                    lang = cc.get('languageCode') or self._search_regex(r'/[a-z]{2}\.vtt', cc_url, 'lang', default='en')
+                    lang = cc.get('languageCode') or self._search_regex(r'/([a-z]{2})\.vtt', cc_url, 'lang', default='en')
                     subtitles.setdefault(lang, []).append({
                         'url': cc_url,
                     })