mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-12 14:26:49 +01:00
[ie/youtube] Fix comment_count
extraction (#11274)
Authored by: bashonly
This commit is contained in:
parent
fbc66e3ab3
commit
7af1ddaaf2
@ -4701,11 +4701,12 @@ def process_language(container, base_url, lang_code, sub_name, query):
|
|||||||
headers=self.generate_api_headers(ytcfg=master_ytcfg),
|
headers=self.generate_api_headers(ytcfg=master_ytcfg),
|
||||||
note='Downloading initial data API JSON')
|
note='Downloading initial data API JSON')
|
||||||
|
|
||||||
|
COMMENTS_SECTION_IDS = ('comment-item-section', 'engagement-panel-comments-section')
|
||||||
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',
|
'contents', ..., 'commentsEntryPointHeaderRenderer', 'commentCount',
|
||||||
), (
|
), (
|
||||||
'engagementPanels', lambda _, v: v['engagementPanelSectionListRenderer']['panelIdentifier'] == 'comment-item-section',
|
'engagementPanels', lambda _, v: v['engagementPanelSectionListRenderer']['panelIdentifier'] in COMMENTS_SECTION_IDS,
|
||||||
'engagementPanelSectionListRenderer', 'header', 'engagementPanelTitleHeaderRenderer', 'contextualInfo',
|
'engagementPanelSectionListRenderer', 'header', 'engagementPanelTitleHeaderRenderer', 'contextualInfo',
|
||||||
), expected_type=self._get_count, get_all=False)
|
), expected_type=self._get_count, get_all=False)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user