- pl_fiji = self._search_regex(
- r'pl_fiji = \'([^\']+)\'', webpage, 'video data')
- pl_c_qual = self._search_regex(
- r'pl_c_qual = "(.)"', webpage, 'video quality')
- video_url = _decode(pl_fiji)
- formats = [{
- 'url': video_url,
- 'format_id': 'default-%s' % pl_c_qual,
- }]
-
- qualities_json = self._search_regex(
- r'var pl_qualities\s*=\s*(.*?);\n', webpage, 'quality info')
- qualities_data = json.loads(qualities_json)
-
- for i, t in enumerate(
- re.findall(r"pl_fiji_([a-z0-9]+)\s*=\s*'([^']+')", webpage)):
- quality_id, crypted_url = t
- video_url = _decode(crypted_url)
+ fmts = {}
+ for fmt in ('mp4', 'flv'):
+ fmt_list = self._parse_json(self._search_regex(
+ r'var %sjson\s*=\s*(\[.*?\]);' % fmt, webpage, '%s formats' % fmt), video_id)
+ for f in fmt_list:
+ fmts[f['fname']] = _decode(f['sUrl'])
+
+ qualities = self._parse_json(self._search_regex(
+ r'var player_btns\s*=\s*(.*?);\n', webpage, 'quality info'), video_id)
+
+ formats = []
+ for fname, url in fmts.items():