+ formats = []
+ for format_ in re.findall(r'({[^}]*\bsrc\s*:\s*[^}]*})', webpage):
+ mobj = re.search(r'(src\s*:\s*[^(]+\(([^)]*)\)[\s,]*)', format_)
+ if mobj is None:
+ continue
+
+ format_ = format_.replace(mobj.group(0), '')
+
+ video = self._parse_json(
+ format_, video_id, transform_source=js_to_json,
+ fatal=False) or {}
+
+ mobj = re.search(
+ r'([\'"])(?P<src>(?:(?!\1).)+)\1\s*,\s*(?P<val>\d+)',
+ mobj.group(1))
+ if mobj is None:
+ continue
+
+ src = decrypt_src(mobj.group('src'), int_or_none(mobj.group('val')))
+ if not src:
+ continue
+
+ ext = determine_ext(src, default_ext=None)
+ if video.get('type') == 'application/dash+xml' or ext == 'mpd':
+ formats.extend(self._extract_mpd_formats(
+ src, video_id, mpd_id='dash', fatal=False))
+ else:
+ formats.append({
+ 'url': src,
+ 'ext': ext or 'mp4',
+ 'width': int_or_none(video.get('width')),
+ 'height': int_or_none(video.get('height')),
+ 'tbr': int_or_none(video.get('bitrate')),
+ })