[vk] Fix extraction (closes #22522)
authorSergey M․ <dstftw@gmail.com>
Fri, 27 Sep 2019 17:04:52 +0000 (00:04 +0700)
committerSergey M․ <dstftw@gmail.com>
Fri, 27 Sep 2019 17:04:52 +0000 (00:04 +0700)
youtube_dl/extractor/vk.py

index f57ed228870b1d094c8c5b42e88f6983671670f6..8b6dc0e244982f46cbc0d65bf5133b3505779fb0 100644 (file)
@@ -403,8 +403,17 @@ class VKIE(VKBaseIE):
             data = self._parse_json(
                 self._search_regex(
                     r'var\s+playerParams\s*=\s*({.+?})\s*;\s*\n', info_page,
-                    'player params'),
-                video_id)['params'][0]
+                    'player params', default='{}'),
+                video_id)
+            if data:
+                data = data['params'][0]
+
+        # <!--{...}
+        if not data:
+            data = self._parse_json(
+                self._search_regex(
+                    r'<!--\s*({.+})', info_page, 'payload'),
+                video_id)['payload'][-1][-1]['player']['params'][0]
 
         title = unescapeHTML(data['md_title'])