diff options
author | Sergey M․ <dstftw@gmail.com> | 2016-10-25 21:05:29 +0700 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2016-10-25 21:05:29 +0700 |
commit | 9305a0dc60ea8c3b72e42e183ac09009806a0ea6 (patch) | |
tree | aea457c2bd88345e3acd75e4dc022d38491075cc /youtube_dl | |
parent | 94e08950e325c120be4f5be24eda9021cc222297 (diff) |
[vk] Fix extraction (closes #11022)
Diffstat (limited to 'youtube_dl')
-rw-r--r-- | youtube_dl/extractor/vk.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/youtube_dl/extractor/vk.py b/youtube_dl/extractor/vk.py index df43ba867..1990e7093 100644 --- a/youtube_dl/extractor/vk.py +++ b/youtube_dl/extractor/vk.py @@ -3,7 +3,6 @@ from __future__ import unicode_literals import collections import re -import json import sys from .common import InfoExtractor @@ -369,8 +368,18 @@ class VKIE(VKBaseIE): opts_url = 'http:' + opts_url return self.url_result(opts_url) - data_json = self._search_regex(r'var\s+vars\s*=\s*({.+?});', info_page, 'vars') - data = json.loads(data_json) + # vars does not look to be served anymore since 24.10.2016 + data = self._parse_json( + self._search_regex( + r'var\s+vars\s*=\s*({.+?});', info_page, 'vars', default='{}'), + video_id, fatal=False) + + # <!json> is served instead + if not data: + data = self._parse_json( + self._search_regex( + r'<!json>\s*({.+?})\s*<!>', info_page, 'json'), + video_id)['player']['params'][0] title = unescapeHTML(data['md_title']) |