Skip to content

Commit

Permalink
Fix comment count not extracted sometimes
Browse files Browse the repository at this point in the history
YouTube created a new key 'commentCount' in addition to 'headerText'
  • Loading branch information
user234683 committed Aug 25, 2023
1 parent 07a29e0 commit 239366d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion youtube/yt_data_extract/watch_extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,8 @@ def _extract_watch_info_mobile(top_level):
# https://www.androidpolice.com/2019/10/31/google-youtube-app-comment-section-below-videos/
# https://www.youtube.com/watch?v=bR5Q-wD-6qo
if header_type == 'commentsEntryPointHeaderRenderer':
comment_count_text = extract_str(comment_info.get('headerText'))
comment_count_text = extract_str(multi_get(
comment_info, 'commentCount', 'headerText'))
else:
comment_count_text = extract_str(deep_get(comment_info,
'header', 'commentSectionHeaderRenderer', 'countText'))
Expand Down

0 comments on commit 239366d

Please sign in to comment.