diff --git a/yt_dlp/downloader/niconico.py b/yt_dlp/downloader/niconico.py index 265f6b2e30..17a8f8f91b 100644 --- a/yt_dlp/downloader/niconico.py +++ b/yt_dlp/downloader/niconico.py @@ -181,11 +181,7 @@ def real_download(self, filename, info_dict): ie = NiconicoIE(self.ydl) video_id = info_dict['id'] - - # Get format index - for format_index, fmt in enumerate(info_dict['formats']): - if fmt['format_id'] == info_dict['format_id']: - break + format_index = next((i for i, fmt in enumerate(info_dict['formats']) if fmt['format_id'] == info_dict['format_id'])) # Get video info total_duration = 0