- flashvars = self._parse_json(
- self._search_regex(
- r'flashvars\s*=\s*({.+?});\r?\n', webpage, 'flashvars'),
- video_id)
-
- formats = []
- for key, video_url in flashvars.items():
- if not isinstance(video_url, compat_str) or not video_url.startswith('http'):
- continue
- height = self._search_regex(
- r'quality_(\d+)[pP]', key, 'height', default=None)
- if not height:
- continue
- if flashvars.get('encrypted') is True:
- video_url = aes_decrypt_text(
- video_url, flashvars['video_title'], 32).decode('utf-8')
- formats.append({
- 'url': video_url,
- 'format_id': '%sp' % height,
- 'height': int(height),
- })
- self._sort_formats(formats)
-
- thumbnail = flashvars.get('image_url')
-
- title = self._html_search_regex(
- r'videoTitle\s*=\s*"([^"]+)', webpage, 'title')