From 92067638b10f8debbbfa4ffd4a3cd990a2c2149e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs?= Date: Sun, 26 Dec 2021 13:29:55 -0500 Subject: Disable dislikes Ref: https://blog.youtube/news-and-events/update-to-youtube/ --- youtube/templates/watch.html | 2 +- youtube/watch.py | 1 - youtube/yt_data_extract/watch_extraction.py | 5 ----- 3 files changed, 1 insertion(+), 7 deletions(-) (limited to 'youtube') diff --git a/youtube/templates/watch.html b/youtube/templates/watch.html index 84585a2..7c8f5cf 100644 --- a/youtube/templates/watch.html +++ b/youtube/templates/watch.html @@ -78,7 +78,7 @@
Uploaded by {{ uploader }}
{{ view_count }} views - {{ like_count }} likes {{ dislike_count }} dislikes + {{ like_count }} likes
diff --git a/youtube/watch.py b/youtube/watch.py index c9a5f77..85b4bd9 100644 --- a/youtube/watch.py +++ b/youtube/watch.py @@ -694,7 +694,6 @@ def get_watch_page(video_id=None): time_published_utc=time_utc_isoformat(info['time_published']), view_count = (lambda x: '{:,}'.format(x) if x is not None else "")(info.get("view_count", None)), like_count = (lambda x: '{:,}'.format(x) if x is not None else "")(info.get("like_count", None)), - dislike_count = (lambda x: '{:,}'.format(x) if x is not None else "")(info.get("dislike_count", None)), download_formats = download_formats, other_downloads = other_downloads, video_info = json.dumps(video_info), diff --git a/youtube/yt_data_extract/watch_extraction.py b/youtube/yt_data_extract/watch_extraction.py index c73033c..59c5a51 100644 --- a/youtube/yt_data_extract/watch_extraction.py +++ b/youtube/yt_data_extract/watch_extraction.py @@ -135,7 +135,6 @@ def _extract_from_video_information_renderer(renderer_content): def _extract_likes_dislikes(renderer_content): info = { 'like_count': None, - 'dislike_count': None, } for button in renderer_content.get('buttons', ()): button_renderer = button.get('slimMetadataToggleButtonRenderer', {}) @@ -157,8 +156,6 @@ def _extract_likes_dislikes(renderer_content): if 'isLike' in button_renderer: info['like_count'] = count - elif 'isDislike' in button_renderer: - info['dislike_count'] = count return info def _extract_from_owner_renderer(renderer_content): @@ -353,10 +350,8 @@ def _extract_watch_info_desktop(top_level): likes_dislikes = deep_get(video_info, 'sentimentBar', 'sentimentBarRenderer', 'tooltip', default='').split('/') if len(likes_dislikes) == 2: info['like_count'] = extract_int(likes_dislikes[0]) - info['dislike_count'] = extract_int(likes_dislikes[1]) else: info['like_count'] = None - info['dislike_count'] = None info['title'] = extract_str(video_info.get('title', None)) info['author'] = extract_str(deep_get(video_info, 'owner', 'videoOwnerRenderer', 'title')) -- cgit v1.2.3