]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
[dplayit] Fix extraction (closes #16901)
authorSergey M․ <dstftw@gmail.com>
Wed, 4 Jul 2018 19:14:06 +0000 (02:14 +0700)
committerSergey M․ <dstftw@gmail.com>
Wed, 4 Jul 2018 19:14:06 +0000 (02:14 +0700)
youtube_dl/extractor/dplay.py

index fe47f6dcef72dcac44aa811ca3cc112d93f066cf..a95e3213cbca396cfd881e12b4ab303f1444684e 100644 (file)
@@ -21,6 +21,7 @@ from ..utils import (
     unified_strdate,
     unified_timestamp,
     update_url_query,
+    urljoin,
     USER_AGENTS,
 )
 
@@ -310,9 +311,11 @@ class DPlayItIE(InfoExtractor):
 
         if not info:
             info_url = self._search_regex(
-                r'url\s*[:=]\s*["\']((?:https?:)?//[^/]+/playback/videoPlaybackInfo/\d+)',
-                webpage, 'info url')
+                (r'playback_json_url\s*:\s*(["\'])(?P<url>(?:(?!\1).)+)\1',
+                 r'url\s*[:=]\s*["\'](?P<url>(?:https?:)?//[^/]+/playback/videoPlaybackInfo/\d+)'),
+                webpage, 'info url', group='url')
 
+            info_url = urljoin(url, info_url)
             video_id = info_url.rpartition('/')[-1]
 
             try:
@@ -322,6 +325,8 @@ class DPlayItIE(InfoExtractor):
                             'dplayit_token').value,
                         'Referer': url,
                     })
+                if isinstance(info, compat_str):
+                    info = self._parse_json(info, display_id)
             except ExtractorError as e:
                 if isinstance(e.cause, compat_HTTPError) and e.cause.code in (400, 403):
                     info = self._parse_json(e.cause.read().decode('utf-8'), display_id)