Add support for changing signature param

This commit is contained in:
Omar Roth 2019-02-22 20:36:16 -06:00
parent bdc9196b4a
commit 7f75a7ca0b
2 changed files with 12 additions and 10 deletions

View file

@ -39,7 +39,12 @@ def fetch_decrypt_function(id = "CvFH_6DNRCY")
return decrypt_function return decrypt_function
end end
def decrypt_signature(a, code) def decrypt_signature(fmt, code)
if !fmt["s"]?
return ""
end
a = fmt["s"]
a = a.split("") a = a.split("")
code.each do |item| code.each do |item|
@ -53,7 +58,8 @@ def decrypt_signature(a, code)
end end
end end
return a.join("") signature = a.join("")
return "&#{fmt["sp"]?}=#{signature}"
end end
def splice(a, b) def splice(a, b)

View file

@ -286,10 +286,8 @@ class Video
end end
end end
if streams[0]? && streams[0]["s"]? streams.each do |fmt|
streams.each do |fmt| fmt["url"] += decrypt_signature(fmt, decrypt_function)
fmt["url"] += "&signature=" + decrypt_signature(fmt["s"], decrypt_function)
end
end end
return streams return streams
@ -381,10 +379,8 @@ class Video
end end
end end
if adaptive_fmts[0]? && adaptive_fmts[0]["s"]? adaptive_fmts.each do |fmt|
adaptive_fmts.each do |fmt| fmt["url"] += decrypt_signature(fmt, decrypt_function)
fmt["url"] += "&signature=" + decrypt_signature(fmt["s"], decrypt_function)
end
end end
return adaptive_fmts return adaptive_fmts