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

Code before:
            if not display_resources:
                display_resources = [{'src': media.get('display_src') or media.get('display_url')}]
            duration = float_or_none(media.get('video_duration'))
            timestamp = int_or_none(media.get('taken_at_timestamp') or media.get('date'))
            uploader = try_get(media, lambda x: x['owner']['full_name'])
            uploader_id = try_get(media, lambda x: x['owner']['username'])

            def get_count(keys, kind):
                for key in variadic(keys):
                    count = int_or_none(try_get(
                        media, (lambda x: x['edge_media_%s' % key]['count'],
                                lambda x: x['%ss' % kind]['count'])))
                    if count is not None:
                        return count

            like_count = get_count('preview_like', 'like')
            comment_count = get_count(
                ('preview_comment', 'to_comment', 'to_parent_comment'), 'comment')

            thumbnails = []
            for thumbnail in display_resources:
                thumbnails.append({
                    'url': thumbnail.get('src'),
                    'width': thumbnail.get('config_width'),
                    'height': thumbnail.get('config_height'),
                })

            comments = []
            for comment in try_get(media, lambda x: x['edge_media_to_parent_comment']['edges']):
                comment_dict = comment.get('node', {})
                comment_text = comment_dict.get('text')
                if comment_text:
                    comments.append({
                        'author': try_get(comment_dict, lambda x: x['owner']['username']),
                        'author_id': try_get(comment_dict, lambda x: x['owner']['id']),
                        'id': comment_dict.get('id'),
                        'text': comment_text,
                        'timestamp': int_or_none(comment_dict.get('created_at')),
                    })
            if not video_url:
                edges = try_get(
                    media, lambda x: x['edge_sidecar_to_children']['edges'],
                    list) or []
                if edges:
                    entries = []
                    for edge_num, edge in enumerate(edges, start=1):
                        node = try_get(edge, lambda x: x['node'], dict)
                        if not node:
                            continue
                        node_video_url = url_or_none(node.get('video_url'))
                        if not node_video_url:

Review comment (suggestion):
```suggestion
            thumbnails = [{
                'url': thumbnail['src'],
                'width': thumbnail.get('config_width'),
                'height': thumbnail.get('config_height'),
            } for thumbnail in display_resources if thumbnail.get('src')]
```

Code after:
            if not display_resources:
                display_resources = [{'src': media.get('display_src')}, {'src': media.get('display_url')}]
            duration = float_or_none(media.get('video_duration'))
            timestamp = int_or_none(media.get('taken_at_timestamp') or media.get('date'))
            uploader = try_get(media, lambda x: x['owner']['full_name'])
            uploader_id = try_get(media, lambda x: x['owner']['username'])

            def get_count(keys, kind):
                for key in variadic(keys):
                    count = int_or_none(try_get(
                        media, (lambda x: x['edge_media_%s' % key]['count'],
                                lambda x: x['%ss' % kind]['count'])))
                    if count is not None:
                        return count

            like_count = get_count('preview_like', 'like')
            comment_count = get_count(
                ('preview_comment', 'to_comment', 'to_parent_comment'), 'comment')

            thumbnails = [{
                'url': thumbnail['src'],
                'width': thumbnail.get('config_width'),
                'height': thumbnail.get('config_height'),
            } for thumbnail in display_resources if thumbnail.get('src')]

            comments = []
            for comment in try_get(media, lambda x: x['edge_media_to_parent_comment']['edges']):
                comment_dict = comment.get('node', {})
                comment_text = comment_dict.get('text')
                if comment_text:
                    comments.append({
                        'author': try_get(comment_dict, lambda x: x['owner']['username']),
                        'author_id': try_get(comment_dict, lambda x: x['owner']['id']),
                        'id': comment_dict.get('id'),
                        'text': comment_text,
                        'timestamp': int_or_none(comment_dict.get('created_at')),
                    })
            if not video_url:
                edges = try_get(
                    media, lambda x: x['edge_sidecar_to_children']['edges'],
                    list) or []
                if edges:
                    entries = []
                    for edge_num, edge in enumerate(edges, start=1):
                        node = try_get(edge, lambda x: x['node'], dict)
                        if not node:
                            continue
                        node_video_url = url_or_none(node.get('video_url'))
                        if not node_video_url:
                            continue
                        entries.append({