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

Code before:
            'ext': 'mp4',
            'title': 'Fahaka puffer feeding',
            'timestamp': 1533835503,
            'upload_date': '20180809',
            'release_date': '20180809',
            'like_count': int,
            'duration': 30.0,
            'comment_count': int,
            'release_timestamp': 1533835503,
            'thumbnail': 'https://i.imgur.com/jxBXAMCh.jpg',
            'dislike_count': int,
        },
    },
        # from https://github.com/yt-dlp/yt-dlp/issues/9458
        {
        'url': 'https://imgur.com/zV03bd5',
        'md5': '4CB52A2B62E3C21EFF561DF0611C1E89',
        'info_dict': {
            'id': 'zV03bd5',
            'ext': 'mp4',
            'title': 'Ive - Liz',
            'timestamp': 1710491255,
            'upload_date': '20240315',
            'like_count': int,
            'dislike_count': int,
            'duration': 56.0,
            'comment_count': int,
            'release_timestamp': 1710491255,
            'release_date': '20240315',
        },
    }]

    def _real_extract(self, url):
        video_id = self._match_id(url)
        data = self._call_api('media', video_id)
        if not traverse_obj(data, ('media', 0, (
                ('type', {lambda t: t == 'video' or None}),
                ('metadata', 'is_animated'))), get_all=False):
            raise ExtractorError(f'{video_id} is not a video or animated image', expected=True)
        webpage = self._download_webpage(
            f'https://i.imgur.com/{video_id}.gifv', video_id, fatal=False) or ''
        formats = []

        media_fmt = traverse_obj(data, ('media', 0, {
            'url': ('url', {url_or_none}),
            'ext': ('ext', {str}),
            'width': ('width', {int_or_none}),
            'height': ('height', {int_or_none}),
            'filesize': ('size', {int_or_none}),
            'acodec': ('metadata', 'has_sound', {lambda b: None if b else 'none'}),
        }))

Review comment (suggestion):
use [`devscripts/run_tests.py`](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#adding-support-for-a-new-site) and let it output the correct test data for you
```suggestion
            'duration': 56.92,
```

Code after:
            'ext': 'mp4',
            'title': 'Fahaka puffer feeding',
            'timestamp': 1533835503,
            'upload_date': '20180809',
            'release_date': '20180809',
            'like_count': int,
            'duration': 30.0,
            'comment_count': int,
            'release_timestamp': 1533835503,
            'thumbnail': 'https://i.imgur.com/jxBXAMCh.jpg',
            'dislike_count': int,
        },
    }, {
        # needs Accept header, ref: https://github.com/yt-dlp/yt-dlp/issues/9458
        'url': 'https://imgur.com/zV03bd5',
        'md5': '59df97884e8ba76143ff6b640a0e2904',
        'info_dict': {
            'id': 'zV03bd5',
            'ext': 'mp4',
            'title': 'Ive - Liz',
            'timestamp': 1710491255,
            'upload_date': '20240315',
            'like_count': int,
            'dislike_count': int,
            'duration': 56.92,
            'comment_count': int,
            'release_timestamp': 1710491255,
            'release_date': '20240315',
        },
    }]

    def _real_extract(self, url):
        video_id = self._match_id(url)
        data = self._call_api('media', video_id)
        if not traverse_obj(data, ('media', 0, (
                ('type', {lambda t: t == 'video' or None}),
                ('metadata', 'is_animated'))), get_all=False):
            raise ExtractorError(f'{video_id} is not a video or animated image', expected=True)
        webpage = self._download_webpage(
            f'https://i.imgur.com/{video_id}.gifv', video_id, fatal=False) or ''
        formats = []

        media_fmt = traverse_obj(data, ('media', 0, {
            'url': ('url', {url_or_none}),
            'ext': ('ext', {str}),
            'width': ('width', {int_or_none}),
            'height': ('height', {int_or_none}),
            'filesize': ('size', {int_or_none}),
            'acodec': ('metadata', 'has_sound', {lambda b: None if b else 'none'}),
        }))
        media_url = media_fmt.get('url')