From 4148d1e4630f3a6a19a2d71f410934844530e89f Mon Sep 17 00:00:00 2001 From: girst Date: Wed, 15 Dec 2021 16:52:45 +0100 Subject: [PATCH] remove rating and thumbs up/down, as that is now removed from the response --- app/youtube/lib.py | 11 ----------- app/youtube/templates/watch.html.j2 | 6 ------ 2 files changed, 17 deletions(-) diff --git a/app/youtube/lib.py b/app/youtube/lib.py index 4c1b5a4..afcf8a2 100644 --- a/app/youtube/lib.py +++ b/app/youtube/lib.py @@ -42,23 +42,12 @@ def prepare_metadata(metadata): endcards = prepare_endcards(metadata) - # the rating goes from 1 to 5, and is the ratio of up- to down votes, plus 1 - if meta.get('averageRating', 0) != 0: - thumbs_up = 100 * (meta['averageRating']-1) / 4 # reconstructed ratio - thumbs_dn = 100 - thumbs_up - else: # no thumbs given - thumbs_up = 0 - thumbs_dn = 0 - thumbs = meta['thumbnail']['thumbnails'] poster = sorted(thumbs, key=lambda t: t['width'], reverse=True)[0]['url'] return { **video_metadata(metadata), 'description': meta['shortDescription'], - 'rating': meta.get('averageRating', 0), - 'thumbs_up': thumbs_up, - 'thumbs_dn': thumbs_dn, 'aspectr': aspect_ratio, 'unlisted': not meta['isCrawlable'], 'poster': poster, diff --git a/app/youtube/templates/watch.html.j2 b/app/youtube/templates/watch.html.j2 index d47cdda..cfe7a2a 100644 --- a/app/youtube/templates/watch.html.j2 +++ b/app/youtube/templates/watch.html.j2 @@ -91,12 +91,6 @@ var sha256=function a(b){function c(a,b){return a>>>b|a<<32-b}for(var d,e,f=Math
{{ length | format_time }}
Views
{{ '{0:,}'.format(views | int)|replace(",","'") }} -
Rating - {% if rating == 0 %} -
n/a - {% else %} -
{{ thumbs_up | round(1) }}% 👍︎⁄👎︎ {{ thumbs_dn | round(1) }}% - {% endif %}
Visibility
{{ 'unlisted' if unlisted else 'public' }} -- 2.39.3