|
|
@ -26,12 +26,16 @@ module Invidious::Frontend::WatchPage
|
|
|
|
return String.build(4000) do |str|
|
|
|
|
return String.build(4000) do |str|
|
|
|
|
str << "<form"
|
|
|
|
str << "<form"
|
|
|
|
str << " class=\"pure-form pure-form-stacked\""
|
|
|
|
str << " class=\"pure-form pure-form-stacked\""
|
|
|
|
str << " action='/latest_version'"
|
|
|
|
str << " action='/download'"
|
|
|
|
str << " method='get'"
|
|
|
|
str << " method='post'"
|
|
|
|
str << " rel='noopener'"
|
|
|
|
str << " rel='noopener'"
|
|
|
|
str << " target='_blank'>"
|
|
|
|
str << " target='_blank'>"
|
|
|
|
str << '\n'
|
|
|
|
str << '\n'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Hidden inputs for video id and title
|
|
|
|
|
|
|
|
str << "<input type='hidden' name='id' value='" << video.id << "'/>\n"
|
|
|
|
|
|
|
|
str << "<input type='hidden' name='title' value='" << HTML.escape(video.title) << "'/>\n"
|
|
|
|
|
|
|
|
|
|
|
|
str << "\t<div class=\"pure-control-group\">\n"
|
|
|
|
str << "\t<div class=\"pure-control-group\">\n"
|
|
|
|
|
|
|
|
|
|
|
|
str << "\t\t<label for='download_widget'>"
|
|
|
|
str << "\t\t<label for='download_widget'>"
|
|
|
@ -48,8 +52,7 @@ module Invidious::Frontend::WatchPage
|
|
|
|
|
|
|
|
|
|
|
|
height = itag_to_metadata?(option["itag"]).try &.["height"]?
|
|
|
|
height = itag_to_metadata?(option["itag"]).try &.["height"]?
|
|
|
|
|
|
|
|
|
|
|
|
title = URI.encode_www_form("#{video.title}-#{video.id}.#{mimetype.split("/")[1]}")
|
|
|
|
value = {"itag": option["itag"], "ext": mimetype.split("/")[1]}.to_json
|
|
|
|
value = {"id": video.id, "itag": option["itag"], "title": title}.to_json
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
str << "\t\t\t<option value='" << value << "'>"
|
|
|
|
str << "\t\t\t<option value='" << value << "'>"
|
|
|
|
str << (height || "~240") << "p - " << mimetype
|
|
|
|
str << (height || "~240") << "p - " << mimetype
|
|
|
@ -61,8 +64,7 @@ module Invidious::Frontend::WatchPage
|
|
|
|
video_assets.video_streams.each do |option|
|
|
|
|
video_assets.video_streams.each do |option|
|
|
|
|
mimetype = option["mimeType"].as_s.split(";")[0]
|
|
|
|
mimetype = option["mimeType"].as_s.split(";")[0]
|
|
|
|
|
|
|
|
|
|
|
|
title = URI.encode_www_form("#{video.title}-#{video.id}.#{mimetype.split("/")[1]}")
|
|
|
|
value = {"itag": option["itag"], "ext": mimetype.split("/")[1]}.to_json
|
|
|
|
value = {"id": video.id, "itag": option["itag"], "title": title}.to_json
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
str << "\t\t\t<option value='" << value << "'>"
|
|
|
|
str << "\t\t\t<option value='" << value << "'>"
|
|
|
|
str << option["qualityLabel"] << " - " << mimetype << " @ " << option["fps"] << "fps - video only"
|
|
|
|
str << option["qualityLabel"] << " - " << mimetype << " @ " << option["fps"] << "fps - video only"
|
|
|
@ -74,8 +76,7 @@ module Invidious::Frontend::WatchPage
|
|
|
|
video_assets.audio_streams.each do |option|
|
|
|
|
video_assets.audio_streams.each do |option|
|
|
|
|
mimetype = option["mimeType"].as_s.split(";")[0]
|
|
|
|
mimetype = option["mimeType"].as_s.split(";")[0]
|
|
|
|
|
|
|
|
|
|
|
|
title = URI.encode_www_form("#{video.title}-#{video.id}.#{mimetype.split("/")[1]}")
|
|
|
|
value = {"itag": option["itag"], "ext": mimetype.split("/")[1]}.to_json
|
|
|
|
value = {"id": video.id, "itag": option["itag"], "title": title}.to_json
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
str << "\t\t\t<option value='" << value << "'>"
|
|
|
|
str << "\t\t\t<option value='" << value << "'>"
|
|
|
|
str << mimetype << " @ " << (option["bitrate"]?.try &.as_i./ 1000) << "k - audio only"
|
|
|
|
str << mimetype << " @ " << (option["bitrate"]?.try &.as_i./ 1000) << "k - audio only"
|
|
|
@ -85,8 +86,7 @@ module Invidious::Frontend::WatchPage
|
|
|
|
# Subtitles (a.k.a "closed captions")
|
|
|
|
# Subtitles (a.k.a "closed captions")
|
|
|
|
|
|
|
|
|
|
|
|
video_assets.captions.each do |caption|
|
|
|
|
video_assets.captions.each do |caption|
|
|
|
|
title = URI.encode_www_form("#{video.title}-#{video.id}.#{caption.language_code}.vtt")
|
|
|
|
value = {"label": caption.name, "ext": "#{caption.language_code}.vtt"}.to_json
|
|
|
|
value = {"id": video.id, "label": caption.name, "title": title}.to_json
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
str << "\t\t\t<option value='" << value << "'>"
|
|
|
|
str << "\t\t\t<option value='" << value << "'>"
|
|
|
|
str << translate(locale, "download_subtitles", translate(locale, caption.name))
|
|
|
|
str << translate(locale, "download_subtitles", translate(locale, caption.name))
|
|
|
|