Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/instagram.py (Python)

Code before:
            formats = []
            if isinstance(video_info, list):
                video_info = video_info[0]
            vcodec = video_info.get('video_codec')
            dash_manifest_raw = video_info.get('video_dash_manifest')
            videos_list = video_info.get('video_versions')
            if not (dash_manifest_raw or videos_list):
                continue
            for format in videos_list:
                formats.append({
                    'url': format.get('url'),
                    'width': format.get('width'),
                    'height': format.get('height'),
                    'vcodec': vcodec,
                })
            if dash_manifest_raw:
                formats.extend(self._parse_mpd_formats(self._parse_xml(dash_manifest_raw, story_id), mpd_id='dash'))
            self._sort_formats(formats)
            thumbnails = []
            thumbnails_list = traverse_obj(video_info, ('image_versions2', 'candidates')) or []
            for thumbnail in thumbnails_list:
                thumbnails.append({
                    'url': thumbnail.get('url'),
                    'width': thumbnail.get('width'),
                    'height': thumbnail.get('height')
                })
            entites.append({
                'id': video_info.get('id'),
                'title': f'Story by {username}',
                'timestamp': int_or_none(video_info.get('taken_at')),
                'uploader': traverse_obj(videos, ('user', 'full_name')),
                'duration': float_or_none(video_info.get('video_duration')),
                'uploader_id': user_id,
                'thumbnails': thumbnails,
                'formats': formats,
            })

        return self.playlist_result(entites, playlist_id=story_id, playlist_title=highlight_title)


Review comment (suggestion):
```suggestion
            thumbnails = [{
                'url': thumbnail.get('url'),
                'width': thumbnail.get('width'),
                'height': thumbnail.get('height')
            } for thumbnail in traverse_obj(video_info, ('image_versions2', 'candidates')) or []]
```

Code after:
            formats = []
            if isinstance(video_info, list):
                video_info = video_info[0]
            vcodec = video_info.get('video_codec')
            dash_manifest_raw = video_info.get('video_dash_manifest')
            videos_list = video_info.get('video_versions')
            if not (dash_manifest_raw or videos_list):
                continue
            for format in videos_list:
                formats.append({
                    'url': format.get('url'),
                    'width': format.get('width'),
                    'height': format.get('height'),
                    'vcodec': vcodec,
                })
            if dash_manifest_raw:
                formats.extend(self._parse_mpd_formats(self._parse_xml(dash_manifest_raw, story_id), mpd_id='dash'))
            self._sort_formats(formats)
            thumbnails = [{
                'url': thumbnail.get('url'),
                'width': thumbnail.get('width'),
                'height': thumbnail.get('height')
            } for thumbnail in traverse_obj(video_info, ('image_versions2', 'candidates')) or []]
            entites.append({
                'id': video_info.get('id'),
                'title': f'Story by {username}',
                'timestamp': int_or_none(video_info.get('taken_at')),
                'uploader': traverse_obj(videos, ('user', 'full_name')),
                'duration': float_or_none(video_info.get('video_duration')),
                'uploader_id': user_id,
                'thumbnails': thumbnails,
                'formats': formats,
            })

        return self.playlist_result(entites, playlist_id=story_id, playlist_title=highlight_title)