diff --git a/src/invidious.cr b/src/invidious.cr index 78b05d46e..9e95121a3 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -1440,6 +1440,12 @@ get "/embed/:id" do |env| next templated "error" end + player_response = JSON.parse(video.info["player_response"]) + if player_response["captions"]? + captions = player_response["captions"]["playerCaptionsTracklistRenderer"]["captionTracks"]?.try &.as_a + end + captions ||= [] of JSON::Any + if video.info["hlsvp"]? hlsvp = video.info["hlsvp"] diff --git a/src/invidious/helpers.cr b/src/invidious/helpers.cr index 3d8fc7d0b..5bb30c076 100644 --- a/src/invidious/helpers.cr +++ b/src/invidious/helpers.cr @@ -728,7 +728,7 @@ def fill_links(html, scheme, host) end end - html = html.to_xml + html = html.xpath_node(%q(//p[@id="eow-description"])).not_nil!.to_xml end def login_req(login_form, f_req) diff --git a/src/invidious/views/embed.ecr b/src/invidious/views/embed.ecr index 669fc8648..d3c9719b3 100644 --- a/src/invidious/views/embed.ecr +++ b/src/invidious/views/embed.ecr @@ -54,10 +54,14 @@ video, #my_video, .video-js, .vjs-default-skin " type='<%= fmt["type"] %>' label="<%= fmt["label"] %>" selected="<%= quality == fmt["label"].split(" - ")[0] %>"> <% else %> " type='<%= fmt["type"] %>' label="<%= fmt["label"] %>" selected="<%= i == 0 ? true : false %>"> - <% end %> - <% end %> + <% end %> + <% captions.each do |caption| %> + " + srclang="<%= caption["languageCode"] %>" label="<%= caption["name"]["simpleText"]%> "> + <% end %> <% end %> <% end %> +<% end %>