summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authortechmetx11 <techmetx11@disroot.org>2023-01-14 01:49:58 +0100
committerSamantaz Fox <coding@samantaz.fr>2023-02-26 14:01:08 +0100
commit8eca5b270ed10b6233371f5495cf059bc353dcb1 (patch)
treeba4ac914b3a6001d7c8c9240f0b93ce53296f7b7 /src
parentb287ff21265007c13895a58537b8771353e8e22b (diff)
downloadinvidious-8eca5b270ed10b6233371f5495cf059bc353dcb1.tar.gz
invidious-8eca5b270ed10b6233371f5495cf059bc353dcb1.tar.bz2
invidious-8eca5b270ed10b6233371f5495cf059bc353dcb1.zip
Video: Fix 0 views, and empty license field
Diffstat (limited to 'src')
-rw-r--r--src/invidious/videos/parser.cr2
-rw-r--r--src/invidious/views/watch.ecr6
2 files changed, 6 insertions, 2 deletions
diff --git a/src/invidious/videos/parser.cr b/src/invidious/videos/parser.cr
index cf43f1be..04ee7303 100644
--- a/src/invidious/videos/parser.cr
+++ b/src/invidious/videos/parser.cr
@@ -186,7 +186,7 @@ def parse_video_info(video_id : String, player_response : Hash(String, JSON::Any
# then from videoDetails, as the latter is "0" for livestreams (we want
# to get the amount of viewers watching).
views_txt = video_primary_renderer
- .try &.dig?("viewCount", "videoViewCountRenderer", "viewCount", "runs", 0, "text")
+ .try &.dig?("viewCount", "videoViewCountRenderer", "viewCount", "simpleText")
views_txt ||= video_details["viewCount"]?
views = views_txt.try &.as_s.gsub(/\D/, "").to_i64?
diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr
index 666eb3b0..c23a9552 100644
--- a/src/invidious/views/watch.ecr
+++ b/src/invidious/views/watch.ecr
@@ -181,7 +181,11 @@ we're going to need to do it here in order to allow for translations.
<% end %>
</p>
<% if video.license %>
- <p id="license"><%= translate(locale, "License: ") %><%= video.license %></p>
+ <% if video.license == "" %>
+ <p id="license"><%= translate(locale, "License: ") %><%= translate(locale, "Standard YouTube license") %></p>
+ <% else %>
+ <p id="license"><%= translate(locale, "License: ") %><%= video.license %></p>
+ <% end %>
<% end %>
<p id="family_friendly"><%= translate(locale, "Family friendly? ") %><%= translate_bool(locale, video.is_family_friendly) %></p>
<p id="wilson" style="display: none; visibility: hidden;"></p>