aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesus <heckyel@riseup.net>2023-09-11 04:15:25 +0800
committerJesus <heckyel@riseup.net>2023-09-11 04:15:25 +0800
commit83af4ab0d7c3b002b451f8c113783982d173bb61 (patch)
treeac5044e4d8ee3c033d36bbbb353beb0a621426ae
parent5594d017e28a5524a97da8e9f9b113737c431415 (diff)
downloadyt-local-83af4ab0d7c3b002b451f8c113783982d173bb61.tar.lz
yt-local-83af4ab0d7c3b002b451f8c113783982d173bb61.tar.xz
yt-local-83af4ab0d7c3b002b451f8c113783982d173bb61.zip
Fix comment count not extracted sometimes
YouTube created a new key 'commentCount' in addition to 'headerText'
-rw-r--r--youtube/yt_data_extract/watch_extraction.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/youtube/yt_data_extract/watch_extraction.py b/youtube/yt_data_extract/watch_extraction.py
index 6090e44..1a926b2 100644
--- a/youtube/yt_data_extract/watch_extraction.py
+++ b/youtube/yt_data_extract/watch_extraction.py
@@ -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'))