- 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*<!>', r'<!json>\s*({.+})'],
+ info_page, 'json', default='{}'),
+ video_id)
+ if data:
+ data = data['player']['params'][0]
+
+ if not data:
+ data = self._parse_json(
+ self._search_regex(
+ r'var\s+playerParams\s*=\s*({.+?})\s*;\s*\n', info_page,
+ 'player params'),
+ video_id)['params'][0]