webpage = self._download_webpage(url, video_id)
- m3u8_urls = re.findall(
- r'var hlsSource.+? = (["\'])(?P<url>http.+?\.m3u8)', webpage)
+ m3u8_urls = []
+
+ for m in re.finditer(
+ r'(["\'])(?P<url>http.+?\.m3u8.*?)\1', webpage):
+ m3u8_fast_url, m3u8_no_fast_url = m.group('url'), m.group(
+ 'url').replace('_fast', '')
+ for m3u8_url in (m3u8_fast_url, m3u8_no_fast_url):
+ if m3u8_url not in m3u8_urls:
+ m3u8_urls.append(m3u8_url)
if not m3u8_urls:
error = self._search_regex(
formats = []
for m3u8_url in m3u8_urls:
- formats.append(self._extract_m3u8_formats(m3u8_url, video_id, ext='mp4')[0])
-
+ m3u8_id = 'fast' if '_fast' in m3u8_url else 'slow'
+ formats.extend(self._extract_m3u8_formats(
+ m3u8_url, video_id, ext='mp4',
+ # ffmpeg skips segments for fast m3u8
+ preference=-10 if m3u8_id == 'fast' else None,
+ m3u8_id=m3u8_id, fatal=False, live=True))
self._sort_formats(formats)
return {