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

Code before:
            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:
            endpoint = self.get_service_endpoint(did, video_id)
            formats.append({
                'format_id': 'blob',
                'url': update_url_query(self._BLOB_URL % endpoint, {'did': did, 'cid': video_cid}),
                **traverse_obj(root, (*embed_path, 'aspectRatio', {
                    'width': ('width', {int_or_none}),
                    'height': ('height', {int_or_none}),
                })),
                **traverse_obj(root, (*record_path, *record_subpath, 'video', {
                    'filesize': ('size', {int_or_none}),
                    'ext': ('mimeType', {mimetype2ext}),
                })),
            })
            for sub_data in traverse_obj(root, (
                    *record_path, *record_subpath, 'captions', lambda _, v: v['file']['ref']['$link'])):
                subtitles.setdefault(sub_data.get('lang') or 'und', []).append({
                    'url': update_url_query(self._BLOB_URL % endpoint, {'did': did, 'cid': sub_data['file']['ref']['$link']}),
                    'ext': traverse_obj(sub_data, ('file', 'mimeType', {mimetype2ext})),
                })
        entries.append({
            'id': video_id,
            'formats': formats,
            'subtitles': subtitles,
            **traverse_obj(root, {
                'id': ('uri', {lambda x: x.split('/')[-1] or None}, {str}),
                'thumbnail': (*embed_path, 'thumbnail', {url_or_none}),
                'alt_title': (*embed_path, 'alt', {str}),
                'uploader': ('author', 'displayName', {str}),
                'uploader_id': ('author', 'handle', {str}),
                'uploader_url': ('author', 'handle', {self._build_profile_url}),
                'channel_id': ('author', 'did', {str}),
                'channel_url': ('author', 'did', {self._build_profile_url}),
                'like_count': ('likeCount', {int_or_none}),
                'repost_count': ('repostCount', {int_or_none}),
                'comment_count': ('replyCount', {int_or_none}),
                'timestamp': ('indexedAt', {parse_iso8601}),
                'tags': ('labels', ..., 'val', {str}, all, {lambda x: list(set(x))}),
                'age_limit': ('labels', ..., 'val', {lambda x: 18 if x in ('sexual', 'porn', 'graphic-media') else None}, any),
                'description': (*record_path, 'text', {str}, any),
                'title': (*record_path, 'text', {lambda x: truncate_string(x, 50)}),
            }),
        })

Review comment (refactor):
line was too long before the `_BLOB_URL_TMPL` name change
```suggestion
                    'url': update_url_query(
                        self._BLOB_URL_TMPL % endpoint, {'did': did, 'cid': sub_data['file']['ref']['$link']}),
```

Code after:
        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:
            endpoint = self._get_service_endpoint(did, video_id)

            formats.append({
                'format_id': 'blob',
                'url': update_url_query(
                    self._BLOB_URL_TMPL.format(endpoint), {'did': did, 'cid': video_cid}),
                **traverse_obj(root, (*embed_path, 'aspectRatio', {
                    'width': ('width', {int_or_none}),
                    'height': ('height', {int_or_none}),
                })),
                **traverse_obj(root, (*record_path, *record_subpath, 'video', {
                    'filesize': ('size', {int_or_none}),
                    'ext': ('mimeType', {mimetype2ext}),
                })),
            })

            for sub_data in traverse_obj(root, (
                    *record_path, *record_subpath, 'captions', lambda _, v: v['file']['ref']['$link'])):
                subtitles.setdefault(sub_data.get('lang') or 'und', []).append({
                    'url': update_url_query(
                        self._BLOB_URL_TMPL.format(endpoint), {'did': did, 'cid': sub_data['file']['ref']['$link']}),
                    'ext': traverse_obj(sub_data, ('file', 'mimeType', {mimetype2ext})),
                })

        entries.append({
            'id': video_id,
            'formats': formats,
            'subtitles': subtitles,
            **traverse_obj(root, {
                'id': ('uri', {url_basename}),
                'thumbnail': (*embed_path, 'thumbnail', {url_or_none}),
                'alt_title': (*embed_path, 'alt', {str}, filter),
                'uploader': ('author', 'displayName', {str}),
                'uploader_id': ('author', 'handle', {str}),
                'uploader_url': ('author', 'handle', {self._build_profile_url}),
                'channel_id': ('author', 'did', {str}),
                'channel_url': ('author', 'did', {self._build_profile_url}),
                'like_count': ('likeCount', {int_or_none}),
                'repost_count': ('repostCount', {int_or_none}),