[kaltura] Fix service URL extraction (closes #22658)
authorSergey M․ <dstftw@gmail.com>
Wed, 9 Oct 2019 17:24:03 +0000 (00:24 +0700)
committerSergey M․ <dstftw@gmail.com>
Wed, 9 Oct 2019 17:24:03 +0000 (00:24 +0700)
youtube_dl/extractor/kaltura.py

index 1c486c038f2824023017231d96fb8510c61aff16..2d38b758b72a852c6d9718f0537c62e7c215e903 100644 (file)
@@ -155,11 +155,11 @@ class KalturaIE(InfoExtractor):
                     embed_info[k] = v.strip()
             url = 'kaltura:%(partner_id)s:%(id)s' % embed_info
             escaped_pid = re.escape(embed_info['partner_id'])
-            service_url = re.search(
-                r'<script[^>]+src=["\']((?:https?:)?//.+?)/p/%s/sp/%s00/embedIframeJs' % (escaped_pid, escaped_pid),
+            service_mobj = re.search(
+                r'<script[^>]+src=(["\'])(?P<id>(?:https?:)?//(?:(?!\1).)+)/p/%s/sp/%s00/embedIframeJs' % (escaped_pid, escaped_pid),
                 webpage)
-            if service_url:
-                url = smuggle_url(url, {'service_url': service_url.group(1)})
+            if service_mobj:
+                url = smuggle_url(url, {'service_url': service_mobj.group('id')})
             return url
 
     def _kaltura_api_call(self, video_id, actions, service_url=None, *args, **kwargs):