diff --git a/src/invidious/frontend/watch_page_n.cr b/src/invidious/frontend/watch_page_n.cr new file mode 100644 index 00000000..c8cb7110 --- /dev/null +++ b/src/invidious/frontend/watch_page_n.cr @@ -0,0 +1,107 @@ +module Invidious::Frontend::WatchPage + extend self + + # A handy structure to pass many elements at + # once to the download widget function + struct VideoAssets + getter full_videos : Array(Hash(String, JSON::Any)) + getter video_streams : Array(Hash(String, JSON::Any)) + getter audio_streams : Array(Hash(String, JSON::Any)) + getter captions : Array(Invidious::Videos::Captions::Metadata) + + def initialize( + @full_videos, + @video_streams, + @audio_streams, + @captions + ) + end + end + + def download_widget(locale : String, video : Video, video_assets : VideoAssets) : String + if CONFIG.disabled?("downloads") + return "
#{translate(locale, "Download is disabled")}
" + end + + return String.build(4000) do |str| + str << "\n" + end + end +end