- videos = re.findall(
- r'var __video([\da-zA-Z]+?)(Low|High)StreamUrl = \'(http://.+?)\?noProxy=1\'', webpage)
-
- mobj = re.search(r'flashVars = (?P<flashvars>{.+?});', webpage)
- if mobj:
- flashvars = json.loads(mobj.group('flashvars'))
- for key, quality in [('hashlink', 'low'), ('hd', 'high')]:
- redirect_url = flashvars.get(key)
- if redirect_url:
- videos.append(('flv', quality, redirect_url))
- thumbnail = flashvars['urlWallpaper']
- else:
- thumbnail = self._og_search_thumbnail(webpage)
-
- formats = []
- for format_, quality, redirect_url in videos:
- format_id = '%s-%s' % (format_.lower(), quality.lower())
- video_url = self._download_webpage(
- redirect_url, video_id, 'Downloading %s video link' % format_id, fatal=False)
- if not video_url:
- continue
- formats.append({
- 'url': video_url,
- 'ext': format_.lower(),
- 'format_id': format_id,
- 'quality': 1 if quality.lower() == 'high' else 0,
- })
+ quality = qualities(['SD', 'HD'])
+ formats = [{
+ 'url': source['file'],
+ 'format_id': '%s-%s' % (source['label'], determine_ext(source['file'])),
+ 'quality': quality(source['label']),
+ } for source in json.loads(js_to_json(self._search_regex(
+ r"(?s)'sources'\s*:\s*(\[.+?\])", webpage, 'sources')))]