From 444b1c99d0a0c69b6dc60559ef6b1647984623ab Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Wed, 5 Jan 2022 02:43:17 +0100 Subject: [PATCH] Show unavailable videos in playlists --- spec/helpers_spec.cr | 6 +++--- src/invidious/playlists.cr | 14 ++++++-------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/spec/helpers_spec.cr b/spec/helpers_spec.cr index 4215b2bd9..c1592048a 100644 --- a/spec/helpers_spec.cr +++ b/spec/helpers_spec.cr @@ -43,11 +43,11 @@ describe "Helper" do describe "#produce_playlist_continuation" do it "correctly produces ctoken for requesting index `x` of a playlist" do - produce_playlist_continuation("UUCla9fZca4I7KagBtgRGnOw", 100).should eq("4qmFsgJNEhpWTFVVQ2xhOWZaY2E0STdLYWdCdGdSR25PdxoUQ0FGNkJsQlVPa05IVVElM0QlM0SaAhhVVUNsYTlmWmNhNEk3S2FnQnRnUkduT3c%3D") + produce_playlist_continuation("UUCla9fZca4I7KagBtgRGnOw", 100).should eq("4qmFsgJNEhpWTFVVQ2xhOWZaY2E0STdLYWdCdGdSR25PdxoUQ0FGNkJsQlVPa05CUmNJR0FnZ0GaAhhVVUNsYTlmWmNhNEk3S2FnQnRnUkduT3c%3D") - produce_playlist_continuation("UCCla9fZca4I7KagBtgRGnOw", 200).should eq("4qmFsgJLEhpWTFVVQ2xhOWZaY2E0STdLYWdCdGdSR25PdxoSQ0FKNkIxQlVPa05OWjBJJTNEmgIYVVVDbGE5ZlpjYTRJN0thZ0J0Z1JHbk93") + produce_playlist_continuation("UCCla9fZca4I7KagBtgRGnOw", 200).should eq("4qmFsgJNEhpWTFVDQ2xhOWZaY2E0STdLYWdCdGdSR25PdxoUQ0FGNkJsQlVPa05CU2NJR0FnZ0GaAhhVQ0NsYTlmWmNhNEk3S2FnQnRnUkduT3c%3D") - produce_playlist_continuation("PL55713C70BA91BD6E", 100).should eq("4qmFsgJBEhRWTFBMNTU3MTNDNzBCQTkxQkQ2RRoUQ0FGNkJsQlVPa05IVVElM0QlM0SaAhJQTDU1NzEzQzcwQkE5MUJENkU%3D") + produce_playlist_continuation("PL55713C70BA91BD6E", 100).should eq("4qmFsgJDEhRWTFBMNTU3MTNDNzBCQTkxQkQ2RRoUQ0FGNkJsQlVPa05CUmNJR0FnZ0GaAhRVQ1BMNTU3MTNDNzBCQTkxQkQ2RQ%3D%3D") end end diff --git a/src/invidious/playlists.cr b/src/invidious/playlists.cr index 1a8c2adcf..e40be9744 100644 --- a/src/invidious/playlists.cr +++ b/src/invidious/playlists.cr @@ -305,16 +305,14 @@ def produce_playlist_continuation(id, index) .try { |i| Protodec::Any.from_json(i) } .try { |i| Base64.urlsafe_encode(i, padding: false) } - data_wrapper = {"1:varint" => request_count, "15:string" => "PT:#{data}"} - .try { |i| Protodec::Any.cast_json(i) } - .try { |i| Protodec::Any.from_json(i) } - .try { |i| Base64.urlsafe_encode(i) } - .try { |i| URI.encode_www_form(i) } - object = { "80226972:embedded" => { - "2:string" => plid, - "3:string" => data_wrapper, + "2:string" => plid, + "3:base64" => { + "1:varint" => request_count, + "15:string" => "PT:#{data}", + "104:embedded" => {"1:0:varint" => 0_i64}, + }, "35:string" => id, }, }