[extractor/youtube] Fix parsing comment_count (#6523)

Closes #5849
Authored by: nick-cd
This commit is contained in:
Nicholas Defranco 2023-03-14 19:21:14 -04:00 committed by GitHub
parent 427a8fafbb
commit 071670cbea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4268,11 +4268,11 @@ def process_language(container, base_url, lang_code, sub_name, query):
info['comment_count'] = traverse_obj(initial_data, ( info['comment_count'] = traverse_obj(initial_data, (
'contents', 'twoColumnWatchNextResults', 'results', 'results', 'contents', ..., 'itemSectionRenderer', 'contents', 'twoColumnWatchNextResults', 'results', 'results', 'contents', ..., 'itemSectionRenderer',
'contents', ..., 'commentsEntryPointHeaderRenderer', 'commentCount', 'simpleText' 'contents', ..., 'commentsEntryPointHeaderRenderer', 'commentCount'
), ( ), (
'engagementPanels', lambda _, v: v['engagementPanelSectionListRenderer']['panelIdentifier'] == 'comment-item-section', 'engagementPanels', lambda _, v: v['engagementPanelSectionListRenderer']['panelIdentifier'] == 'comment-item-section',
'engagementPanelSectionListRenderer', 'header', 'engagementPanelTitleHeaderRenderer', 'contextualInfo', 'runs', ..., 'text' 'engagementPanelSectionListRenderer', 'header', 'engagementPanelTitleHeaderRenderer', 'contextualInfo'
), expected_type=int_or_none, get_all=False) ), expected_type=self._get_count, get_all=False)
try: # This will error if there is no livechat try: # This will error if there is no livechat
initial_data['contents']['twoColumnWatchNextResults']['conversationBar']['liveChatRenderer']['continuations'][0]['reloadContinuationData']['continuation'] initial_data['contents']['twoColumnWatchNextResults']['conversationBar']['liveChatRenderer']['continuations'][0]['reloadContinuationData']['continuation']