- m3u8_url = self._search_regex(
- r'file\s*:\s*(["\'])(?P<url>.+?)\1\s*\+\s*location\.hash\.substring\(1\)',
- webpage, 'm3u8 url', group='url')
- formats = self._extract_m3u8_formats(m3u8_url, video_id, 'mp4')
+
+ formats = []
+ for _, file_url in re.findall(
+ r'file\s*:\s*(["\'])(?P<url>(?:(?!\1).)+)\1', webpage):
+ ext = determine_ext(file_url)
+ if ext not in ('m3u8', 'mp3'):
+ continue
+ # mp3 served as m3u8 produces stuttered media file
+ if ext == 'm3u8' and '.mp3' in file_url:
+ continue
+ if ext == 'm3u8':
+ formats.extend(self._extract_m3u8_formats(
+ file_url, video_id, 'mp4', entry_protocol='m3u8_native',
+ fatal=False))
+ elif ext == 'mp3':
+ formats.append({
+ 'url': file_url,
+ 'vcodec': 'none',
+ })
+ self._sort_formats(formats)