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

Code before:
            services, ('service', lambda _, x: x.get('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
        if nested_post := traverse_obj(post, ('embed', 'record', ('record', None), {dict}, any)):
            entries.extend(self._extract_videos(
                nested_post, video_id, embed_path=('embeds', 0), record_path='value'))
        if len(entries) == 0:
            self.raise_no_formats('No video could be found in this post', expected=True)
        if len(entries) == 1:
            return entries[0]
        return self.playlist_result(entries, video_id)

    @staticmethod
    def _build_profile_url(path):
        return format_field(path, None, 'https://bsky.app/profile/%s', default=None)

    def _extract_videos(self, root, video_id, embed_path='embed', record_path='record', record_subpath='embed'):
        embed_path = variadic(embed_path, (str, bytes, dict, set))
        record_path = variadic(record_path, (str, bytes, dict, set))
        record_subpath = variadic(record_subpath, (str, bytes, dict, set))
        entries = []
        if external_uri := traverse_obj(root, (((*record_path, *record_subpath), embed_path), 'external', 'uri', {url_or_none}, any)):
            entries.append(self.url_result(external_uri))
        if playlist := traverse_obj(root, (*embed_path, 'playlist', {url_or_none})):
            formats, subtitles = self._extract_m3u8_formats_and_subtitles(
                playlist, video_id, 'mp4', m3u8_id='hls', fatal=False)
        else:
            return entries
        video_cid = traverse_obj(
            root, (*embed_path, 'cid', {str}),
            (*record_path, *record_subpath, 'video', 'ref', '$link', {str}))
        did = traverse_obj(root, ('author', 'did', {str}))
        if did and video_cid:

Review comment (suggestion):
Let's add one test with a playlist
```suggestion
    }, {
        'url': 'https://bsky.app/profile/purpleicetea.bsky.social/post/3l7gv55dc2o2w',
        'info_dict': {
            'id': '3l7gv55dc2o2w',
        },
        'playlist': [{
            'info_dict': {
                'id': '3l7gv55dc2o2w',
                'ext': 'mp4',
                'upload_date': '20241026',
                'description': 'One of my favorite videos',
                'comment_count': int,
                'uploader_url': 'https://bsky.app/profile/purpleicetea.bsky.social',
                'uploader': 'Purple.Ice.Tea',
                'thumbnail': 'https://video.bsky.app/watch/did%3Aplc%3Abjh5ffwya5f53dfy47dezuwx/bafkreicaldzyr6yr26ex4gyr6z2gbwvi53iolrcsqfipqqs3ieb2olcmiu/thumbnail.jpg',
                'channel_url': 'https://bsky.app/profile/did:plc:bjh5ffwya5f53dfy47dezuwx',
                'like_count': int,
                'channel_id': 'did:plc:bjh5ffwya5f53dfy47dezuwx',
                'repost_count': int,
                'timestamp': 1729973202,
                'tags': [],
                'uploader_id': 'purpleicetea.bsky.social',
                'title': 'One of my favorite videos',
            },
        }, {
            '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,
            },
        }],
    }]
```

Code after:
                'tags': [],
                'uploader_id': 'purpleicetea.bsky.social',
                'title': 'One of my favorite videos',
            },
        }, {
            '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': 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 = []