[jwplatform] Add support for multiple embeds (closes #15192)
authorSergey M․ <dstftw@gmail.com>
Sun, 7 Jan 2018 14:49:23 +0000 (21:49 +0700)
committerSergey M․ <dstftw@gmail.com>
Sun, 7 Jan 2018 14:49:23 +0000 (21:49 +0700)
youtube_dl/extractor/generic.py
youtube_dl/extractor/jwplatform.py

index cc4c90b8cef194952e1b7d7517d6036329eb1c79..9b0cd004fd18546794f835f3f0f818992e4dddbe 100644 (file)
@@ -2708,9 +2708,9 @@ class GenericIE(InfoExtractor):
             return self.url_result(viewlift_url)
 
         # Look for JWPlatform embeds
-        jwplatform_url = JWPlatformIE._extract_url(webpage)
-        if jwplatform_url:
-            return self.url_result(jwplatform_url, 'JWPlatform')
+        jwplatform_urls = JWPlatformIE._extract_urls(webpage)
+        if jwplatform_urls:
+            return self.playlist_from_matches(jwplatform_urls, video_id, video_title, ie=JWPlatformIE.ie_key())
 
         # Look for Digiteka embeds
         digiteka_url = DigitekaIE._extract_url(webpage)
index c9bcbb08f787ef74bea78c4b402ecb7b167556e7..63d0dc998cf1cf281dda3c27f3afaae84f4906c9 100644 (file)
@@ -23,11 +23,14 @@ class JWPlatformIE(InfoExtractor):
 
     @staticmethod
     def _extract_url(webpage):
-        mobj = re.search(
-            r'<(?:script|iframe)[^>]+?src=["\'](?P<url>(?:https?:)?//content.jwplatform.com/players/[a-zA-Z0-9]{8})',
+        urls = JWPlatformIE._extract_urls(webpage)
+        return urls[0] if urls else None
+
+    @staticmethod
+    def _extract_urls(webpage):
+        return re.findall(
+            r'<(?:script|iframe)[^>]+?src=["\']((?:https?:)?//content\.jwplatform\.com/players/[a-zA-Z0-9]{8})',
             webpage)
-        if mobj:
-            return mobj.group('url')
 
     def _real_extract(self, url):
         video_id = self._match_id(url)