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

Code before:
                    sd_url = self._search_regex(
                        r'<source[^>]+src=(["\'])(?P<url>.+?)\1', iframe,
                        'sd video url', default=None, group='url')
                    if sd_url:
                        sources.append((sd_url, 'sd'))
                    sources.append((hd_url, 'hd'))

                    formats = [{
                        'url': video_url,
                        'format_id': format_id,
                        'height': int_or_none(self._search_regex(
                            r'_(\d+)\.\w+$', video_url, 'height', default=None)),
                        'quality': quality,
                    } for quality, (video_url, format_id) in enumerate(sources)]

        if not media_json.get('url') and not video_url and not iframe_url:
            # external video host (but we weren't able to figure it out from the api)
            iframe_url = self._search_regex(
                r'src=["\'](https?://safe\.txmblr\.com/svc/embed/inline/[^"\']+)["\']',
                webpage, 'embed iframe url', default=None)
            return self.url_result(iframe_url or redirect_url, 'Generic')

        formats = formats or [{
            'url': media_json.get('url') or video_url,
            'width': int_or_none(media_json.get('width') or self._og_search_property('video:width', webpage, default=None)),
            'height': int_or_none(media_json.get('height') or self._og_search_property('video:height', webpage, default=None)),
        }]
        self._sort_formats(formats)

        # the url we're extracting from might be an original post or it might be a reblog.
        # if it's a reblog, og:description will be the reblogger's comment, not the uploader's.
        # content_json is always the op, so if it exists but has no text, there's no description
        if content_json:
            description = '\n\n'.join((
                item.get('text') for item in content_json if item.get('type') == 'text')) or None
        else:
            description = self._og_search_description(webpage, default=None)
        uploader_id = traverse_obj(post_json, 'reblogged_root_name', 'blog_name')

        return {
            'id': video_id,
            'title': post_json.get('summary') or (blog if api_only else self._html_search_regex(
                r'(?s)<title>(?P<title>.*?)(?: \| Tumblr)?</title>', webpage, 'title')),
            'description': description,
            'thumbnail': (traverse_obj(video_json, ('poster', 0, 'url'))
                          or self._og_search_thumbnail(webpage, default=None)),
            'uploader_id': uploader_id,
            'uploader_url': f'https://{uploader_id}.tumblr.com/' if uploader_id else None,
            'duration': duration,
            'like_count': post_json.get('like_count'),
            'repost_count': post_json.get('reblog_count'),

Review comment (suggestion):
```suggestion
            'width': int_or_none(
                media_json.get('width') or self._og_search_property('video:width', webpage, default=None)),
            'height': int_or_none(
                media_json.get('height') or self._og_search_property('video:height', webpage, default=None)),
```

Code after:
                    sd_url = self._search_regex(
                        r'<source[^>]+src=(["\'])(?P<url>.+?)\1', iframe,
                        'sd video url', default=None, group='url')
                    if sd_url:
                        sources.append((sd_url, 'sd'))
                    sources.append((hd_url, 'hd'))

                    formats = [{
                        'url': video_url,
                        'format_id': format_id,
                        'height': int_or_none(self._search_regex(
                            r'_(\d+)\.\w+$', video_url, 'height', default=None)),
                        'quality': quality,
                    } for quality, (video_url, format_id) in enumerate(sources)]

        if not media_json.get('url') and not video_url and not iframe_url:
            # external video host (but we weren't able to figure it out from the api)
            iframe_url = self._search_regex(
                r'src=["\'](https?://safe\.txmblr\.com/svc/embed/inline/[^"\']+)["\']',
                webpage, 'embed iframe url', default=None)
            return self.url_result(iframe_url or redirect_url, 'Generic')

        formats = formats or [{
            'url': media_json.get('url') or video_url,
            'width': int_or_none(
                media_json.get('width') or self._og_search_property('video:width', webpage, default=None)),
            'height': int_or_none(
                media_json.get('height') or self._og_search_property('video:height', webpage, default=None)),
        }]
        self._sort_formats(formats)

        # the url we're extracting from might be an original post or it might be a reblog.
        # if it's a reblog, og:description will be the reblogger's comment, not the uploader's.
        # content_json is always the op, so if it exists but has no text, there's no description
        if content_json:
            description = '\n\n'.join((
                item.get('text') for item in content_json if item.get('type') == 'text')) or None
        else:
            description = self._og_search_description(webpage, default=None)
        uploader_id = traverse_obj(post_json, 'reblogged_root_name', 'blog_name')

        return {
            'id': video_id,
            'title': post_json.get('summary') or (blog if api_only else self._html_search_regex(
                r'(?s)<title>(?P<title>.*?)(?: \| Tumblr)?</title>', webpage, 'title')),
            'description': description,
            'thumbnail': (traverse_obj(video_json, ('poster', 0, 'url'))
                          or self._og_search_thumbnail(webpage, default=None)),
            'uploader_id': uploader_id,
            'uploader_url': f'https://{uploader_id}.tumblr.com/' if uploader_id else None,
            'duration': duration,