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

Code before:
            video_id, query={'handle': handle}).get('did')

        getcomments = self.get_param('getcomments', False)
        meta = self._download_json(
            'https://public.api.bsky.app/xrpc/app.bsky.feed.getPostThread',
            video_id, headers={'Content-Type': 'application/json'}, query={
                'uri': f'at://{did}/app.bsky.feed.post/{video_id}',
                'depth': 1000 if getcomments else 0,
                'parentHeight': 1000 if getcomments else 0,
            }).get('thread')
        post, record_embed = meta.get('post'), traverse_obj(meta, ('post', 'record', 'embed'))

        formats, subs = self._extract_m3u8_formats_and_subtitles(
            traverse_obj(post, ('embed', 'playlist'), ('embed', 'media', 'playlist')),
            video_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False,
            note='Downloading HD m3u8 information', errnote='Unable to download HD m3u8 information')
        blob_cid = traverse_obj(record_embed, ('video', 'ref', '$link'), ('video', 'cid'),
                                ('media', 'video', 'ref', '$link'), ('media', 'video', 'cid'))
        if blob_cid:
            formats.append({
                'format_id': 'blob',
                'url': f'https://bsky.social/xrpc/com.atproto.sync.getBlob?did={did}&cid={blob_cid}',
                'ext': mimetype2ext(traverse_obj(record_embed, ('video', 'mimeType')), 'mp4'),
                'width': traverse_obj(record_embed, ('aspectRatio', 'width'), expected_type=int_or_none),
                'height': traverse_obj(record_embed, ('aspectRatio', 'height'), expected_type=int_or_none),
                'filesize': traverse_obj(record_embed, ('video', 'size'), expected_type=int_or_none),
            })

        handle = traverse_obj(post, ('author', 'handle'))
        uploader = traverse_obj(post, ('author', 'displayName'))
        description = traverse_obj(post, ('record', 'text'))

        return {
            'id': video_id,
            'title': f'{uploader}: "{description}"',
            'formats': formats,
            'description': description,
            'thumbnail': traverse_obj(post, ('embed', 'thumbnail'), expected_type=url_or_none),
            'alt_title': traverse_obj(post, ('embed', 'alt'), ('record', 'embed', 'alt')),
            'uploader': uploader,
            'channel': handle,
            'uploader_id': did,
            'channel_id': did,
            'uploader_url': f'https://bsky.app/profile/{handle}',
            'channel_url': f'https://bsky.app/profile/{did}',
            'timestamp': parse_iso8601(traverse_obj(post, ('record', 'createdAt'))),
            'like_count': post.get('likeCount'),
            'repost_count': post.get('repostCount'),
            'comment_count': post.get('replyCount'),
            'tags': post.get('labels', []) + traverse_obj(post, ('record', 'langs'), default=[]),
            '__post_extractor': self.extract_comments(meta),

Review comment (suggestion):
You can combine `traverse_obj` calls. Please also do this for the info dict below.
```suggestion
                **traverse_obj(record_embed, {
                    'ext': ('video', 'mimeType', {mimetype2ext}),
                    'width': ('aspectRatio', 'width', {int_or_none}),
                    'height': ('aspectRatio', 'height', {int_or_none}),
                    'filesize': ('video', 'size', {int_or_none}),
                }),
```

Code after:
            'channel_url': 'https://bsky.app/profile/did:plc:z72i7hdynmk6r22z27h6tvur',
            'thumbnail': r're:https://video.bsky.app/watch/.*\.jpg$',
            'title': 'Bluesky now has video! Update your app to versi...',
            'alt_title': 'Bluesky video feature announcement',
            'description': r're:(?s)Bluesky now has video! .{239}',
            'upload_date': '20240911',
            'timestamp': 1726074716,
            'like_count': int,
            'repost_count': int,
            'comment_count': int,
            'tags': [],
            'subtitles': {
                'en': 'mincount:1',
            },
        },
    }, {
        'url': 'https://bsky.app/profile/alt.bun.how/post/3l7rdfxhyds2f',
        'md5': '8775118b235cf9fa6b5ad30f95cda75c',
        'info_dict': {
            'id': '3l7rdfxhyds2f',
            'ext': 'mp4',
            'uploader': 'cinnamon',
            'uploader_id': 'alt.bun.how',
            'uploader_url': 'https://bsky.app/profile/alt.bun.how',
            'channel_id': 'did:plc:7x6rtuenkuvxq3zsvffp2ide',
            'channel_url': 'https://bsky.app/profile/did:plc:7x6rtuenkuvxq3zsvffp2ide',
            'thumbnail': r're:https://video.bsky.app/watch/.*\.jpg$',
            'title': 'crazy that i look like this tbh',
            'description': 'crazy that i look like this tbh',
            'upload_date': '20241030',
            'timestamp': 1730332128,
            'like_count': int,
            'repost_count': int,
            'comment_count': int,
            'tags': ['sexual'],
            'age_limit': 18,
        },
    }, {
        'url': 'at://did:plc:ia76kvnndjutgedggx2ibrem/app.bsky.feed.post/3l6zrz6zyl2dr',
        'md5': '71b0eb6d85d03145e6af6642c7fc6d78',
        'info_dict': {
            'id': '3l6zrz6zyl2dr',
            'ext': 'mp4',
            'uploader': 'mary🐇',
            'uploader_id': 'mary.my.id',
            'uploader_url': 'https://bsky.app/profile/mary.my.id',
            'channel_id': 'did:plc:ia76kvnndjutgedggx2ibrem',
            'channel_url': 'https://bsky.app/profile/did:plc:ia76kvnndjutgedggx2ibrem',
            'thumbnail': r're:https://video.bsky.app/watch/.*\.jpg$',
            'title': 'Bluesky video #3l6zrz6zyl2dr',
            'upload_date': '20241021',