From 7c3c0564f5797e6c92777dd28dec44f79016b352 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Sun, 17 Apr 2022 15:41:13 +0200 Subject: [PATCH] Remove youtube IDs from ChannelVideo/PlaylistVideo #to_xml methods --- src/invidious/channels/channels.cr | 4 +--- src/invidious/helpers/serialized_yt_data.cr | 2 +- src/invidious/playlists.cr | 4 +--- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/invidious/channels/channels.cr b/src/invidious/channels/channels.cr index e0459cc3..fb104779 100644 --- a/src/invidious/channels/channels.cr +++ b/src/invidious/channels/channels.cr @@ -54,9 +54,7 @@ struct ChannelVideo query_params["v"] = self.id xml.element("entry") do - xml.element("id") { xml.text "yt:video:#{self.id}" } - xml.element("yt:videoId") { xml.text self.id } - xml.element("yt:channelId") { xml.text self.ucid } + xml.element("id") { xml.text "ni://invidious/sha-256;" + sha256("video/#{self.id}") } xml.element("title") { xml.text self.title } xml.element("link", rel: "alternate", href: "#{HOST_URL}/watch?#{query_params}") diff --git a/src/invidious/helpers/serialized_yt_data.cr b/src/invidious/helpers/serialized_yt_data.cr index 0dde91fd..082fe97c 100644 --- a/src/invidious/helpers/serialized_yt_data.cr +++ b/src/invidious/helpers/serialized_yt_data.cr @@ -18,7 +18,7 @@ struct SearchVideo query_params["v"] = self.id xml.element("entry") do - xml.element("id") { xml.text self.id } + xml.element("id") { xml.text "ni://invidious/sha-256;" + sha256("video/#{self.id}") } xml.element("title") { xml.text self.title } xml.element("link", rel: "alternate", href: "#{HOST_URL}/watch?#{query_params}") diff --git a/src/invidious/playlists.cr b/src/invidious/playlists.cr index c4eb7507..a4a9d1b6 100644 --- a/src/invidious/playlists.cr +++ b/src/invidious/playlists.cr @@ -13,9 +13,7 @@ struct PlaylistVideo def to_xml(xml : XML::Builder) xml.element("entry") do - xml.element("id") { xml.text "yt:video:#{self.id}" } - xml.element("yt:videoId") { xml.text self.id } - xml.element("yt:channelId") { xml.text self.ucid } + xml.element("id") { xml.text "ni://invidious/sha-256;" + sha256("video/#{self.id}") } xml.element("title") { xml.text self.title } xml.element("link", rel: "alternate", href: "#{HOST_URL}/watch?v=#{self.id}")