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

Code before:
        video_id, display_id = self._match_valid_url(url).group('id', 'display_id')

        webpage = self._download_webpage(url, video_id)
        post = self._search_nextjs_data(webpage, video_id)['props']['pageProps']['ssr_data_posts']
        content = self._parse_json(post['post_contents_json'], video_id)[0]

        uploader = post.get('user_name')
        guests_json = self._parse_json(content.get('guests_json') or '{}', video_id)

        broadcast_id = post.get('content_id')
        live_chat_url = f'https://prankcast.com/api/private/chat/select-broadcast?id={broadcast_id}&cache='

        return {
            'id': video_id,
            'title': post.get('post_title') or self._og_search_title(webpage),
            'display_id': display_id,
            'url': content.get('url'),
            'timestamp': parse_iso8601(content.get('start_date') or content.get('crdate'), ' '),
            'uploader': uploader,
            'channel_id': post.get('user_id'),
            'duration': content.get('duration') or 0,
            'cast': list(filter(None, [uploader] + traverse_obj(guests_json, (..., 'name')))),
            'description': post.get('post_body'),
            'categories': list(filter(None, [content.get('category')])),
            'tags': try_call(lambda: list(filter('', post['post_tags'].split(',')))),
            'subtitles': {'live_chat': [{'url': live_chat_url, 'ext': 'json'}]} if broadcast_id else None
        }


Review comment (performance):
```suggestion
            'subtitles': {
                'live_chat': [{
                    'url': f'https://prankcast.com/api/private/chat/select-broadcast?id={post["content_id"]}&cache=',
                    'ext': 'json',
                }],
            } if post.get('content_id') else None,
```

Code after:
    def _real_extract(self, url):
        video_id, display_id = self._match_valid_url(url).group('id', 'display_id')

        webpage = self._download_webpage(url, video_id)
        post = self._search_nextjs_data(webpage, video_id)['props']['pageProps']['ssr_data_posts']
        content = self._parse_json(post['post_contents_json'], video_id)[0]

        uploader = post.get('user_name')
        guests_json = traverse_obj(content, ('guests_json', {json.loads}, {dict})) or {}

        return {
            'id': video_id,
            'title': post.get('post_title') or self._og_search_title(webpage),
            'display_id': display_id,
            'url': content.get('url'),
            'timestamp': parse_iso8601(content.get('start_date') or content.get('crdate'), ' '),
            'uploader': uploader,
            'channel_id': str_or_none(post.get('user_id')),
            'duration': float_or_none(content.get('duration')),
            'cast': list(filter(None, [uploader] + traverse_obj(guests_json, (..., 'name')))),
            'description': post.get('post_body'),
            'categories': list(filter(None, [content.get('category')])),
            'tags': try_call(lambda: list(filter('', post['post_tags'].split(',')))),
            'subtitles': {
                'live_chat': [{
                    'url': f'https://prankcast.com/api/private/chat/select-broadcast?id={post["content_id"]}&cache=',
                    'ext': 'json',
                }],
            } if post.get('content_id') else None
        }