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

Code before:
        video_id = self._match_id(url)

        meta = self._weibo_download_json(f'https://weibo.com/ajax/statuses/show?id={video_id}', video_id)
        mix_media_info = traverse_obj(meta, ('mix_media_info', 'items'))
        if not mix_media_info:
            return self._parse_video_info(meta)

        playlist_title = traverse_obj(mix_media_info, (0, 'data', 'content1'))
        return self.playlist_result(self._entries(mix_media_info), playlist_title=playlist_title)

    def _entries(self, mix_media_info):
        for media_info in mix_media_info:
            if media_info.get('type') == 'pic':
                continue

            video_info = {
                **traverse_obj(media_info, {
                    'id': ('data', 'object_id'),
                    'page_info': {'media_info': ('data', 'media_info')},
                }),
            }

            # fix filename too long
            del video_info['page_info']['media_info']['kol_title']

            yield self._parse_video_info(video_info)


class WeiboVideoIE(WeiboBaseIE):
    _VALID_URL = r'https?://(?:www\.)?weibo\.com/tv/show/(?P<id>\d+:\d+)'
    _TESTS = [{
        'url': 'https://weibo.com/tv/show/1034:4797699866951785?from=old_pc_videoshow',
        'info_dict': {
            'id': '4797700463137878',
            'ext': 'mp4',
            'display_id': 'LEZDodaiW',
            'title': '呃，稍微了解了一下靡烟miya，感觉这东西也太二了',
            'description': '呃，稍微了解了一下靡烟miya，感觉这东西也太二了 http://t.cn/A6aerGsM \u200b\u200b\u200b',
            'duration': 76,
            'timestamp': 1659344278,
            'upload_date': '20220801',
            'thumbnail': r're:https://.*\.jpg',
            'uploader': '君子爱财陈平安',
            'uploader_id': '3905382233',
            'uploader_url': 'https://weibo.com/u/3905382233',
            'view_count': int,
            'like_count': int,
            'repost_count': int,
        },
    }]


Review comment (suggestion):
```suggestion
            yield self._parse_video_info(traverse_obj(media_info, {
                'id': ('data', 'object_id'),
                'page_info': {'media_info': ('data', 'media_info', {dict})},
            }))
```

Code after:
        mix_media_info = traverse_obj(meta, ('mix_media_info', 'items', ...))
        if not mix_media_info:
            return self._parse_video_info(meta)

        return self.playlist_result(self._entries(mix_media_info), video_id)

    def _entries(self, mix_media_info):
        for media_info in traverse_obj(mix_media_info, lambda _, v: v['type'] != 'pic'):
            yield self._parse_video_info(traverse_obj(media_info, {
                'id': ('data', 'object_id'),
                'page_info': {'media_info': ('data', 'media_info', {dict})},
            }))


class WeiboVideoIE(WeiboBaseIE):
    _VALID_URL = r'https?://(?:www\.)?weibo\.com/tv/show/(?P<id>\d+:\d+)'
    _TESTS = [{
        'url': 'https://weibo.com/tv/show/1034:4797699866951785?from=old_pc_videoshow',
        'info_dict': {
            'id': '4797700463137878',
            'ext': 'mp4',
            'display_id': 'LEZDodaiW',
            'title': '呃，稍微了解了一下靡烟miya，感觉这东西也太二了',
            'description': '呃，稍微了解了一下靡烟miya，感觉这东西也太二了 http://t.cn/A6aerGsM \u200b\u200b\u200b',
            'duration': 76,
            'timestamp': 1659344278,
            'upload_date': '20220801',
            'thumbnail': r're:https://.*\.jpg',
            'uploader': '君子爱财陈平安',
            'uploader_id': '3905382233',
            'uploader_url': 'https://weibo.com/u/3905382233',
            'view_count': int,
            'like_count': int,
            'repost_count': int,
        },
    }]

    def _real_extract(self, url):
        video_id = self._match_id(url)

        post_data = f'data={{"Component_Play_Playinfo":{{"oid":"{video_id}"}}}}'.encode()
        video_info = self._weibo_download_json(
            f'https://weibo.com/tv/api/component?page=%2Ftv%2Fshow%2F{video_id.replace(":", "%3A")}',
            video_id, headers={'Referer': url}, data=post_data)['data']['Component_Play_Playinfo']
        return self.url_result(f'https://weibo.com/0/{video_info["mid"]}', WeiboIE)


class WeiboUserIE(WeiboBaseIE):
    _VALID_URL = r'https?://(?:www\.)?weibo\.com/u/(?P<id>\d+)'
    _TESTS = [{
        'url': 'https://weibo.com/u/2066652961?tabtype=video',