mirror of
https://github.com/iv-org/invidious.git
synced 2024-12-20 21:24:21 -05:00
Merge pull request #2671 from matthewmcgarvey/code-removal
Remove dead code
This commit is contained in:
commit
438b334320
@ -77,16 +77,6 @@ describe "Helper" do
|
||||
end
|
||||
end
|
||||
|
||||
describe "#produce_comment_reply_continuation" do
|
||||
it "correctly produces a continuation token for replies to a given comment" do
|
||||
produce_comment_reply_continuation("cIHQWOoJeag", "UCq6VFHwMzcMXbuKyG7SQYIg", "Ugx1IP_wGVv3WtGWcdV4AaABAg").should eq("EiYSC2NJSFFXT29KZWFnwAEByAEB4AEBogINKP___________wFAABgGMk0aSxIaVWd4MUlQX3dHVnYzV3RHV2NkVjRBYUFCQWciAggAKhhVQ3E2VkZId016Y01YYnVLeUc3U1FZSWcyC2NJSFFXT29KZWFnQAFICg%3D%3D")
|
||||
|
||||
produce_comment_reply_continuation("cIHQWOoJeag", "UCq6VFHwMzcMXbuKyG7SQYIg", "Ugza62y_TlmTu9o2RfF4AaABAg").should eq("EiYSC2NJSFFXT29KZWFnwAEByAEB4AEBogINKP___________wFAABgGMk0aSxIaVWd6YTYyeV9UbG1UdTlvMlJmRjRBYUFCQWciAggAKhhVQ3E2VkZId016Y01YYnVLeUc3U1FZSWcyC2NJSFFXT29KZWFnQAFICg%3D%3D")
|
||||
|
||||
produce_comment_reply_continuation("_cE8xSu6swE", "UC1AZY74-dGVPe6bfxFwwEMg", "UgyBUaRGHB9Jmt1dsUZ4AaABAg").should eq("EiYSC19jRTh4U3U2c3dFwAEByAEB4AEBogINKP___________wFAABgGMk0aSxIaVWd5QlVhUkdIQjlKbXQxZHNVWjRBYUFCQWciAggAKhhVQzFBWlk3NC1kR1ZQZTZiZnhGd3dFTWcyC19jRTh4U3U2c3dFQAFICg%3D%3D")
|
||||
end
|
||||
end
|
||||
|
||||
describe "#produce_channel_community_continuation" do
|
||||
it "correctly produces a continuation token for a channel community" do
|
||||
produce_channel_community_continuation("UCCj956IF62FbT7Gouszaj9w", "Egljb21tdW5pdHm4").should eq("4qmFsgIsEhhVQ0NqOTU2SUY2MkZiVDdHb3VzemFqOXcaEEVnbGpiMjF0ZFc1cGRIbTQ%3D")
|
||||
@ -107,15 +97,6 @@ describe "Helper" do
|
||||
end
|
||||
end
|
||||
|
||||
describe "#extract_plid" do
|
||||
it "correctly extracts playlist ID from trending URL" do
|
||||
extract_plid("/feed/trending?bp=4gIuCggvbS8wNHJsZhIiUExGZ3F1TG5MNTlhbVBud2pLbmNhZUp3MDYzZlU1M3Q0cA%3D%3D").should eq("PLFgquLnL59amPnwjKncaeJw063fU53t4p")
|
||||
extract_plid("/feed/trending?bp=4gIvCgkvbS8wYnp2bTISIlBMaUN2Vkp6QnVwS2tDaFNnUDdGWFhDclo2aEp4NmtlTm0%3D").should eq("PLiCvVJzBupKkChSgP7FXXCrZ6hJx6keNm")
|
||||
extract_plid("/feed/trending?bp=4gIuCggvbS8wNWpoZxIiUEwzWlE1Q3BOdWxRbUtPUDNJekdsYWN0V1c4dklYX0hFUA%3D%3D").should eq("PL3ZQ5CpNulQmKOP3IzGlactWW8vIX_HEP")
|
||||
extract_plid("/feed/trending?bp=4gIuCggvbS8wMnZ4bhIiUEx6akZiYUZ6c21NUnFhdEJnVTdPeGNGTkZhQ2hqTkVERA%3D%3D").should eq("PLzjFbaFzsmMRqatBgU7OxcFNFaChjNEDD")
|
||||
end
|
||||
end
|
||||
|
||||
describe "#sign_token" do
|
||||
it "correctly signs a given hash" do
|
||||
token = {
|
||||
|
@ -60,8 +60,6 @@ def fetch_youtube_comments(id, cursor, format, locale, thin_mode, region, sort_b
|
||||
case cursor
|
||||
when nil, ""
|
||||
ctoken = produce_comment_continuation(id, cursor: "", sort_by: sort_by)
|
||||
# when .starts_with? "Ug"
|
||||
# ctoken = produce_comment_reply_continuation(id, video.ucid, cursor)
|
||||
when .starts_with? "ADSJ"
|
||||
ctoken = produce_comment_continuation(id, cursor: cursor, sort_by: sort_by)
|
||||
else
|
||||
@ -645,38 +643,3 @@ def produce_comment_continuation(video_id, cursor = "", sort_by = "top")
|
||||
|
||||
return continuation
|
||||
end
|
||||
|
||||
def produce_comment_reply_continuation(video_id, ucid, comment_id)
|
||||
object = {
|
||||
"2:embedded" => {
|
||||
"2:string" => video_id,
|
||||
"24:varint" => 1_i64,
|
||||
"25:varint" => 1_i64,
|
||||
"28:varint" => 1_i64,
|
||||
"36:embedded" => {
|
||||
"5:varint" => -1_i64,
|
||||
"8:varint" => 0_i64,
|
||||
},
|
||||
},
|
||||
"3:varint" => 6_i64,
|
||||
"6:embedded" => {
|
||||
"3:embedded" => {
|
||||
"2:string" => comment_id,
|
||||
"4:embedded" => {
|
||||
"1:varint" => 0_i64,
|
||||
},
|
||||
"5:string" => ucid,
|
||||
"6:string" => video_id,
|
||||
"8:varint" => 1_i64,
|
||||
"9:varint" => 10_i64,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
continuation = object.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) }
|
||||
|
||||
return continuation
|
||||
end
|
||||
|
@ -20,13 +20,3 @@ def fetch_trending(trending_type, region, locale)
|
||||
|
||||
return {trending, plid}
|
||||
end
|
||||
|
||||
def extract_plid(url)
|
||||
return url.try { |i| URI.parse(i).query }
|
||||
.try { |i| HTTP::Params.parse(i)["bp"] }
|
||||
.try { |i| URI.decode_www_form(i) }
|
||||
.try { |i| Base64.decode(i) }
|
||||
.try { |i| IO::Memory.new(i) }
|
||||
.try { |i| Protodec::Any.parse(i) }
|
||||
.try &.["44:0:embedded"]?.try &.["2:1:string"]?.try &.as_s
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user