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

Code before:
        parent_uri = traverse_obj(post, ('record', 'reply', 'parent', 'uri'))
        author_handle = traverse_obj(post, ('author', 'handle'))
        author_did = traverse_obj(post, ('author', 'did'), default='')
        yield {
            'id': post.get('uri'),
            'text': traverse_obj(post, ('record', 'text')),
            'timestamp': parse_iso8601(traverse_obj(post, ('record', 'createdAt'))),
            'parent': 'root' if parent_uri == root_uri else parent_uri,
            'like_count': post.get('likeCount'),
            'author': traverse_obj(post, ('author', 'displayName')),
            'author_id': author_did,
            'author_thumbnail': traverse_obj(post, ('author', 'avatar'), expected_type=url_or_none),
            'author_url': f'https://bsky.app/profile/{author_handle}',
            'author_is_uploader': 'Yes' if author_did in root_uri else 'No',
        }
        if replies := thread_node.get('replies'):
            for reply in replies:
                yield from self.traverse_replies(reply, root_uri)
        if parent := thread_node.get('parent'):
            yield from self.traverse_replies(parent, root_uri)

    def _real_extract(self, url):
        handle, video_id = self._match_valid_url(url).groups()
        did = handle if handle.startswith('did:') else self._download_json(
            (f'https://public.api.bsky.app/xrpc/com.atproto.identity.resolveHandle?handle={handle}'),
            video_id, expected_status=200).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},
            expected_status=200).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')),
            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(post, ('embed', 'cid'), ('record', 'embed', 'video', 'ref', '$link'))
        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),
        })


Review comment (suggestion):
```suggestion
        did = handle if handle.startswith('did:') else self._download_json(
            'https://public.api.bsky.app/xrpc/com.atproto.identity.resolveHandle',
            video_id, query={'handle': handle}).get('did')
```

Code after:
            'uploader_id': 'laserbatx',
            'uploader_url': 'https://laserbatx.bandcamp.com',
            'artists': ['LASERBAT'],
            'album_artists': ['LASERBAT'],
            'album': 'Hari Nezumi [EP]',
            'track': 'Forward to the End',
            'title': 'LASERBAT - Forward to the End',
            'thumbnail': 'https://f4.bcbits.com/img/a2507705510_5.jpg',
            'duration': 228.571,
            'track_id': '222792849',
            'release_date': '20230423',
            'upload_date': '20230423',
            'timestamp': 1682276040.0,
            'release_timestamp': 1682276040.0,
            'track_number': 1,
        },
        'add_ie': ['Bandcamp'],
    }, {
        'url': 'https://bsky.app/profile/dannybhoix.bsky.social/post/3l6oe5mtr2c2j',
        'md5': 'b9e344fdbce9f2852c668a97efefb105',
        'info_dict': {
            'id': '3l3vgf77uco2g',
            'ext': 'mp4',
            'uploader': 'Bluesky',
            'uploader_id': 'bsky.app',
            'uploader_url': 'https://bsky.app/profile/bsky.app',
            'channel_id': 'did:plc:z72i7hdynmk6r22z27h6tvur',
            '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',