Invidious is an alternative front-end to YouTube
Fix an infinite recursion caused by #2228
Samantaz Fox60fa552469b5
diff --git a/src/invidious/helpers/serialized_yt_data.cr b/src/invidious/helpers/serialized_yt_data.crindex 1ba3f20e..0cac7c49 100644--- a/src/invidious/helpers/serialized_yt_data.cr+++ b/src/invidious/helpers/serialized_yt_data.cr@@ -58,17 +58,13 @@ struct SearchVideoendend- def to_xml(auto_generated, query_params, xml : XML::Builder | Nil = nil)- if xml- to_xml(HOST_URL, auto_generated, query_params, xml)- else- XML.build do |xml|- to_xml(HOST_URL, auto_generated, query_params, xml)- end+ def to_xml(auto_generated, query_params, _xml : Nil)+ XML.build do |xml|+ to_xml(auto_generated, query_params, xml)endend- def to_json(locale : Hash(String, JSON::Any), json : JSON::Builder)+ def to_json(locale : Hash(String, JSON::Any) | Nil, json : JSON::Builder)json.object dojson.field "type", "video"json.field "title", self.title@@ -99,16 +95,16 @@ struct SearchVideoendend- def to_json(locale, json : JSON::Builder | Nil = nil)- if json+ def to_json(locale : Hash(String, JSON::Any) | Nil, _json : Nil = nil)+ JSON.build do |json|to_json(locale, json)- else- JSON.build do |json|- to_json(locale, json)- endendend+ def to_json(json : JSON::Builder)+ to_json(nil, json)+ end+def is_upcomingpremiere_timestamp ? true : falseend@@ -133,7 +129,7 @@ struct SearchPlaylistproperty videos : Array(SearchPlaylistVideo)property thumbnail : String?- def to_json(locale, json : JSON::Builder)+ def to_json(locale : Hash(String, JSON::Any) | Nil, json : JSON::Builder)json.object dojson.field "type", "playlist"json.field "title", self.title@@ -163,15 +159,15 @@ struct SearchPlaylistendend- def to_json(locale, json : JSON::Builder | Nil = nil)- if json+ def to_json(locale : Hash(String, JSON::Any) | Nil, _json : Nil = nil)+ JSON.build do |json|to_json(locale, json)- else- JSON.build do |json|- to_json(locale, json)- endendend++ def to_json(json : JSON::Builder)+ to_json(nil, json)+ endendstruct SearchChannel@@ -185,7 +181,7 @@ struct SearchChannelproperty description_html : Stringproperty auto_generated : Bool- def to_json(locale, json : JSON::Builder)+ def to_json(locale : Hash(String, JSON::Any) | Nil, json : JSON::Builder)json.object dojson.field "type", "channel"json.field "author", self.author@@ -215,15 +211,15 @@ struct SearchChannelendend- def to_json(locale, json : JSON::Builder | Nil = nil)- if json+ def to_json(locale, _json : Nil = nil)+ JSON.build do |json|to_json(locale, json)- else- JSON.build do |json|- to_json(locale, json)- endendend++ def to_json(json : JSON::Builder)+ to_json(nil, json)+ endendclass Category@@ -235,7 +231,7 @@ class Categoryproperty description_html : Stringproperty badges : Array(Tuple(String, String))?- def to_json(locale, json : JSON::Builder)+ def to_json(locale : Hash(String, JSON::Any) | Nil, json : JSON::Builder)json.object dojson.field "type", "category"json.field "title", self.title@@ -249,15 +245,15 @@ class Categoryendend- def to_json(locale, json : JSON::Builder | Nil = nil)- if json+ def to_json(locale : Hash(String, JSON::Any) | Nil, _json : Nil = nil)+ JSON.build do |json|to_json(locale, json)- else- JSON.build do |json|- to_json(locale, json)- endendend++ def to_json(json : JSON::Builder)+ to_json(nil, json)+ endendalias SearchItem = SearchVideo | SearchChannel | SearchPlaylist | Category