0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-23 02:25:11 +00:00

[vk] Fix extraction (closes #11022)

This commit is contained in:
Sergey M․ 2016-10-25 21:05:29 +07:00
parent 94e08950e3
commit 9305a0dc60
No known key found for this signature in database
GPG key ID: 2C393E0F18A9236D

View file

@ -3,7 +3,6 @@
import collections
import re
import json
import sys
from .common import InfoExtractor
@ -369,8 +368,18 @@ def _real_extract(self, url):
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'])