From 51e8044ad951faba090d55ac7173353d46b4d9b5 Mon Sep 17 00:00:00 2001 From: Fijxu Date: Mon, 4 Nov 2024 23:15:16 -0300 Subject: [PATCH] Videos: Add support for OpenGraph videos To support OpenGraph clients like Discord and other platforms able to pull the video from the OpenGraph metadata. --- src/invidious/routes/watch.cr | 7 +++++++ src/invidious/views/watch.ecr | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/invidious/routes/watch.cr b/src/invidious/routes/watch.cr index 2d2050dd..de5f952a 100644 --- a/src/invidious/routes/watch.cr +++ b/src/invidious/routes/watch.cr @@ -152,6 +152,7 @@ module Invidious::Routes::Watch end end + # Removes non default audio tracks audio_streams.reject! do |z| z if z.dig?("audioTrack", "audioIsDefault") == false end @@ -218,6 +219,12 @@ module Invidious::Routes::Watch captions: video.captions ) + begin + video_url = "https://#{URI.parse(fmt_stream[0]["url"].to_s).query_params["host"]}#{fmt_stream[0]["url"].to_s}" + rescue + video_url = nil + end + templated "watch" end diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr index 70afabcc..533eb453 100644 --- a/src/invidious/views/watch.ecr +++ b/src/invidious/views/watch.ecr @@ -13,9 +13,11 @@ + + - +