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

Code before:
                    response = try_get(browse,
                                       (lambda x: x['response'],
                                        lambda x: x[1]['response'])) or {}

                    if response.get('continuationContents'):
                        break

                    # YouTube sometimes gives reload: now json if something went wrong (e.g. bad auth)
                    if browse.get('reload'):
                        raise ExtractorError('Invalid or missing params in continuation request', expected=False)

                    # TODO: not tested, merged from old extractor
                    err_msg = browse.get('externalErrorMessage')
                    if err_msg:
                        raise ExtractorError('YouTube said: %s' % err_msg, expected=False)

                    # Youtube sometimes sends incomplete data
                    # See: https://github.com/ytdl-org/youtube-dl/issues/28194
                    last_error = 'Incomplete data received'
                    if count >= retries:
                        self._downloader.report_error(last_error)

            if not response:
                break
            visitor_data = try_get(
                response, lambda x: x['responseContext']['webResponseContextExtensionData']['ytConfigData']['visitorData'], compat_str) or visitor_data

            known_continuation_renderers = {
                'itemSectionContinuation': extract_thread,
                'commentRepliesContinuation': extract_thread
            }

            # extract next root continuation from the results
            continuation_contents = try_get(
                response, lambda x: x['continuationContents'], dict) or {}

            for key, value in continuation_contents.items():
                if key not in known_continuation_renderers:
                    continue
                continuation_renderer = value

                if first_continuation:
                    first_continuation = False
                    expected_comment_count = try_get(
                        continuation_renderer,
                        (lambda x: x['header']['commentsHeaderRenderer']['countText']['runs'][0]['text'],
                         lambda x: x['header']['commentsHeaderRenderer']['commentsCount']['runs'][0]['text']),
                        compat_str)

                    if expected_comment_count:
                        comment_counts[1] = str_to_int(expected_comment_count)

Review comment (suggestion):
```suggestion
                response,
                lambda x: x['responseContext']['webResponseContextExtensionData']['ytConfigData']['visitorData'],
                compat_str) or visitor_data
```

Code after:
                    session_token = try_get(browse, lambda x: x['xsrf_token'], compat_str)
                    if session_token:
                        session_token_list[0] = session_token

                    response = try_get(browse,
                                       (lambda x: x['response'],
                                        lambda x: x[1]['response'])) or {}

                    if response.get('continuationContents'):
                        break

                    # YouTube sometimes gives reload: now json if something went wrong (e.g. bad auth)
                    if browse.get('reload'):
                        raise ExtractorError('Invalid or missing params in continuation request', expected=False)

                    # TODO: not tested, merged from old extractor
                    err_msg = browse.get('externalErrorMessage')
                    if err_msg:
                        raise ExtractorError('YouTube said: %s' % err_msg, expected=False)

                    # Youtube sometimes sends incomplete data
                    # See: https://github.com/ytdl-org/youtube-dl/issues/28194
                    last_error = 'Incomplete data received'
                    if count >= retries:
                        self._downloader.report_error(last_error)

            if not response:
                break
            visitor_data = try_get(
                response,
                lambda x: x['responseContext']['webResponseContextExtensionData']['ytConfigData']['visitorData'],
                compat_str) or visitor_data

            known_continuation_renderers = {
                'itemSectionContinuation': extract_thread,
                'commentRepliesContinuation': extract_thread
            }

            # extract next root continuation from the results
            continuation_contents = try_get(
                response, lambda x: x['continuationContents'], dict) or {}

            for key, value in continuation_contents.items():
                if key not in known_continuation_renderers:
                    continue
                continuation_renderer = value

                if first_continuation:
                    first_continuation = False
                    expected_comment_count = try_get(
                        continuation_renderer,