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

Code before:
            'uploader_url': 'https://bsky.app/profile/mary.my.id',
            'channel_id': 'did:plc:ia76kvnndjutgedggx2ibrem',
            'channel_url': 'https://bsky.app/profile/did:plc:ia76kvnndjutgedggx2ibrem',
            'thumbnail': 'https://video.bsky.app/watch/did%3Aplc%3Aia76kvnndjutgedggx2ibrem/bafkreiasced5yaaodnspwgmuwvbxhoghbkq7iibhl3ftjgupq3brmgfwkm/thumbnail.jpg',
            'title': 'Bluesky video #3l6zrz6zyl2dr',
            'alt_title': '',
            'description': '',
            'upload_date': '20241021',
            'timestamp': 1729523172,
            'like_count': int,
            'repost_count': int,
            'comment_count': int,
            'tags': [],
            'language': 'en',
        },
    }]
    _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.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)

Review comment (suggestion):
Can be fatal inside of traversals
```suggestion
            services, ('service', lambda _, x: x['type'] == 'AtprotoPersonalDataServer',
```

Code after:
            'like_count': int,
            'repost_count': int,
            'comment_count': int,
            'tags': [],
        },
    }, {
        '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': r're:https://video.bsky.app/watch/.*\.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': 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,
            },
        }],
    }]