]> jfr.im git - yt-dlp.git/commitdiff
Fix some videos downloading with m3u8 extension
authorpukkandan <redacted>
Sun, 7 Mar 2021 17:52:12 +0000 (23:22 +0530)
committerpukkandan <redacted>
Sun, 7 Mar 2021 17:52:12 +0000 (23:22 +0530)
yt_dlp/extractor/common.py

index edfc5a7823888eb23dfb8cd4710c613e24712574..0b790ac7d2a34e4dbd5a27643ae2e28f135edb0d 100644 (file)
@@ -1849,8 +1849,9 @@ def _m3u8_meta_format(self, m3u8_url, ext=None, preference=None, quality=None, m
 
     def _extract_m3u8_formats(self, m3u8_url, video_id, ext=None,
                               entry_protocol='m3u8', preference=None, quality=None,
-                              m3u8_id=None, live=False, note=None, errnote=None,
-                              fatal=True, data=None, headers={}, query={}):
+                              m3u8_id=None, note=None, errnote=None,
+                              fatal=True, live=False, data=None, headers={},
+                              query={}):
         res = self._download_webpage_handle(
             m3u8_url, video_id,
             note=note or 'Downloading m3u8 information',
@@ -2050,11 +2051,11 @@ def build_stream_name():
                 playlist_formats = _extract_m3u8_playlist_formats(manifest_url, video_id=video_id,
                                                                   fatal=fatal, data=data, headers=headers)
 
-                for format in playlist_formats:
+                for frmt in playlist_formats:
                     format_id = []
                     if m3u8_id:
                         format_id.append(m3u8_id)
-                    format_index = format.get('index')
+                    format_index = frmt.get('index')
                     stream_name = build_stream_name()
                     # Bandwidth of live streams may differ over time thus making
                     # format_id unpredictable. So it's better to keep provided
@@ -2109,6 +2110,8 @@ def build_stream_name():
                             # TODO: update acodec for audio only formats with
                             # the same GROUP-ID
                             f['acodec'] = 'none'
+                    if not f.get('ext'):
+                        f['ext'] = 'm4a' if f.get('vcodec') == 'none' else 'mp4'
                     formats.append(f)
 
                     # for DailyMotion