Fix bug with m3u8 format extraction

This commit is contained in:
pukkandan 2021-02-26 18:12:30 +05:30
parent c552ae8838
commit ed9b7e3dd3

View File

@ -1888,8 +1888,10 @@ def _parse_m3u8_formats(self, m3u8_doc, m3u8_url, ext=None,
# media playlist and MUST NOT appear in master playlist thus we can # media playlist and MUST NOT appear in master playlist thus we can
# clearly detect media playlist with this criterion. # clearly detect media playlist with this criterion.
def _extract_m3u8_playlist_formats(format_url, m3u8_doc=None): def _extract_m3u8_playlist_formats(format_url=None, m3u8_doc=None):
if not m3u8_doc: if not m3u8_doc:
if not format_url:
return []
res = self._download_webpage_handle( res = self._download_webpage_handle(
format_url, video_id, format_url, video_id,
note=False, note=False,
@ -1928,7 +1930,7 @@ def _extract_m3u8_playlist_formats(format_url, m3u8_doc=None):
if '#EXT-X-TARGETDURATION' in m3u8_doc: # media playlist, return as is if '#EXT-X-TARGETDURATION' in m3u8_doc: # media playlist, return as is
playlist_formats = _extract_m3u8_playlist_formats(m3u8_doc, True) playlist_formats = _extract_m3u8_playlist_formats(m3u8_doc=m3u8_doc)
for format in playlist_formats: for format in playlist_formats:
format_id = [] format_id = []