- 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)
- f = {
- 'format_id': quality_id,
- 'url': video_url,
- 'quality': i,
- }
- if quality_id in qualities_data:
- qd = qualities_data[quality_id]
- m = re.match(
- r'''(?x)<b>(?P<width>[0-9]+)x(?P<height>[0-9]+)<\\/b>
- \s*\(\s*(?P<tbr>[0-9]+)\s*kb\\/s''', qd)
- if m:
- f['width'] = int(m.group('width'))
- f['height'] = int(m.group('height'))
- f['tbr'] = int(m.group('tbr'))
- formats.append(f)
+ gexo_files = self._parse_json(
+ self._search_regex(
+ r'var\s+gexoFiles\s*=\s*({.+?});', webpage, 'gexo files'),
+ video_id)
+
+ formats = []
+ for format_id, f in gexo_files.items():
+ video_url = f.get('url')
+ if not video_url:
+ continue
+ fmt = f.get('fmt')
+ height = f.get('h')
+ format_id = '%s_%sp' % (fmt, height) if fmt and height else format_id
+ formats.append({
+ 'url': _decode(video_url),
+ 'format_id': format_id,
+ 'width': int_or_none(f.get('w')),
+ 'height': int_or_none(height),
+ 'tbr': int_or_none(f.get('br')),
+ })