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

Code before:
            'info_dict': {
                'id': '3l77u64l7le2e',
                'ext': 'mp4',
                'title': 'hearing people on twitter say that bluesky isn\'...',
                'like_count': int,
                'uploader_id': 'thafnine.net',
                'uploader_url': 'https://bsky.app/profile/thafnine.net',
                'upload_date': '20241024',
                'channel_url': 'https://bsky.app/profile/did:plc:6ttyq36rhiyed7wu3ws7dmqj',
                'description': 'md5:dba7d54d6df7e5b79a24d7b287dafbe9',
                'tags': [],
                'alt_title': 'md5:9b1ee1937fb3d1a81e932f9ec14d560e',
                'uploader': 'T9',
                'channel_id': 'did:plc:6ttyq36rhiyed7wu3ws7dmqj',
                'thumbnail': 'https://video.bsky.app/watch/did%3Aplc%3A6ttyq36rhiyed7wu3ws7dmqj/bafkreih4xf5k22urq5kytjbnlj2djnzmlrqnvotnglmoy35mkpobrwtota/thumbnail.jpg',
                'timestamp': 1729731642,
                'comment_count': int,
                'repost_count': int,
            },
        }],
    }]
    _BLOB_URL = '%s/xrpc/com.atproto.sync.getBlob'

    def get_service_endpoint(self, did, video_id):
        if did.startswith('did:web:'):
            url = f'https://{did.split(":")[-1]}/.well-known/did.json'
        else:
            url = f'https://plc.directory/{did}'
        services = self._download_json(url, video_id, fatal=False)
        return traverse_obj(
            services, ('service', lambda _, x: x['type'] == 'AtprotoPersonalDataServer',
                       'serviceEndpoint', {url_or_none}, any)) or 'https://bsky.social'

    def _real_extract(self, url):
        handle, video_id = self._match_valid_url(url).groups()

        post = self._download_json(
            'https://public.api.bsky.app/xrpc/app.bsky.feed.getPostThread',
            video_id, headers={'Content-Type': 'application/json'}, query={
                'uri': f'at://{handle}/app.bsky.feed.post/{video_id}',
                'depth': 0,
                'parentHeight': 0,
            })['thread']['post']

        entries = []
        # app.bsky.embed.video.view/app.bsky.embed.external.view
        entries.extend(self._extract_videos(post, video_id))
        # app.bsky.embed.recordWithMedia.view
        entries.extend(self._extract_videos(
            post, video_id, embed_path=('embed', 'media'), record_subpath=('embed', 'media')))
        # app.bsky.embed.record.view

Review comment (suggestion):
could we do this?
```suggestion
            url = f'https://{did[8:]}/.well-known/did.json'
```

Code after:
                'title': 'hearing people on twitter say that bluesky isn\'...',
                'like_count': int,
                'uploader_id': 'thafnine.net',
                'uploader_url': 'https://bsky.app/profile/thafnine.net',
                'upload_date': '20241024',
                'channel_url': 'https://bsky.app/profile/did:plc:6ttyq36rhiyed7wu3ws7dmqj',
                'description': r're:(?s)hearing people on twitter say that bluesky .{93}',
                'tags': [],
                'alt_title': 'md5:9b1ee1937fb3d1a81e932f9ec14d560e',
                'uploader': 'T9',
                'channel_id': 'did:plc:6ttyq36rhiyed7wu3ws7dmqj',
                'thumbnail': r're:https://video.bsky.app/watch/.*\.jpg$',
                'timestamp': 1729731642,
                'comment_count': int,
                'repost_count': int,
            },
        }],
    }]
    _BLOB_URL_TMPL = '{}/xrpc/com.atproto.sync.getBlob'

    def _get_service_endpoint(self, did, video_id):
        if did.startswith('did:web:'):
            url = f'https://{did[8:]}/.well-known/did.json'
        else:
            url = f'https://plc.directory/{did}'
        services = self._download_json(
            url, video_id, 'Fetching service endpoint', 'Falling back to bsky.social', fatal=False)
        return traverse_obj(
            services, ('service', lambda _, x: x['type'] == 'AtprotoPersonalDataServer',
                       'serviceEndpoint', {url_or_none}, any)) or 'https://bsky.social'

    def _real_extract(self, url):
        handle, video_id = self._match_valid_url(url).group('handle', 'id')

        post = self._download_json(
            'https://public.api.bsky.app/xrpc/app.bsky.feed.getPostThread',
            video_id, query={
                'uri': f'at://{handle}/app.bsky.feed.post/{video_id}',
                'depth': 0,
                'parentHeight': 0,
            })['thread']['post']

        entries = []
        # app.bsky.embed.video.view/app.bsky.embed.external.view
        entries.extend(self._extract_videos(post, video_id))
        # app.bsky.embed.recordWithMedia.view
        entries.extend(self._extract_videos(
            post, video_id, embed_path=('embed', 'media'), record_subpath=('embed', 'media')))
        # app.bsky.embed.record.view
        if nested_post := traverse_obj(post, ('embed', 'record', ('record', None), {dict}, any)):
            entries.extend(self._extract_videos(