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

Code before:
                (lambda x: x['entry_data']['PostPage'][0]['graphql']['shortcode_media'],
                 lambda x: x['entry_data']['PostPage'][0]['media']),
                dict)
        # _sharedData.entry_data.PostPage is empty when authenticated (see
        # https://github.com/ytdl-org/youtube-dl/pull/22880)
        if not media:
            additional_data = self._parse_json(
                self._search_regex(
                    r'window\.__additionalDataLoaded\s*\(\s*[^,]+,\s*({.+?})\s*\)\s*;',
                    webpage, 'additional data', default='{}'),
                video_id, fatal=False)
            if additional_data:
                media = try_get(
                    additional_data, lambda x: x['graphql']['shortcode_media'],
                    dict)
        if media:
            video_url = media.get('video_url')
            height = try_get(media, lambda x: x['dimensions']['height'])
            width = try_get(media, lambda x: x['dimensions']['width'])
            description = try_get(
                media, lambda x: x['edge_media_to_caption']['edges'][0]['node']['text'],
                compat_str) or media.get('caption')
            title = media.get('title')
            display_resources = media.get('display_resources')
            if not display_resources:
                display_resources = [{'url': 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'),
                })


Review comment (suggestion):
Did u mean to do this?
```suggestion
                display_resources = [{'src': media.get('display_src') or media.get('display_url')}]
```

Code after:
                (lambda x: x['entry_data']['PostPage'][0]['graphql']['shortcode_media'],
                 lambda x: x['entry_data']['PostPage'][0]['media']),
                dict)
        # _sharedData.entry_data.PostPage is empty when authenticated (see
        # https://github.com/ytdl-org/youtube-dl/pull/22880)
        if not media:
            additional_data = self._parse_json(
                self._search_regex(
                    r'window\.__additionalDataLoaded\s*\(\s*[^,]+,\s*({.+?})\s*\)\s*;',
                    webpage, 'additional data', default='{}'),
                video_id, fatal=False)
            if additional_data:
                media = try_get(
                    additional_data, lambda x: x['graphql']['shortcode_media'],
                    dict)
        if media:
            video_url = media.get('video_url')
            height = try_get(media, lambda x: x['dimensions']['height'])
            width = try_get(media, lambda x: x['dimensions']['width'])
            description = try_get(
                media, lambda x: x['edge_media_to_caption']['edges'][0]['node']['text'],
                compat_str) or media.get('caption')
            title = media.get('title')
            display_resources = media.get('display_resources')
            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']):