Fix comment count not extracted sometimes

YouTube created a new key 'commentCount' in addition to 'headerText'
This commit is contained in:
Jesus 2023-09-11 04:15:25 +08:00
parent 5594d017e2
commit 83af4ab0d7
No known key found for this signature in database
GPG Key ID: E607CE7149F4D71C

View File

@ -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'))