mirror of
https://github.com/iv-org/invidious.git
synced 2024-12-02 03:31:20 +05:30
Fix signature extraction
This commit is contained in:
parent
45fa148380
commit
9d5dddab29
@ -4,22 +4,21 @@ def fetch_decrypt_function(client, id = "CvFH_6DNRCY")
|
|||||||
player = client.get(url).body
|
player = client.get(url).body
|
||||||
|
|
||||||
function_name = player.match(/"signature",(?<name>[a-zA-Z0-9]{2})\(/).not_nil!["name"]
|
function_name = player.match(/"signature",(?<name>[a-zA-Z0-9]{2})\(/).not_nil!["name"]
|
||||||
function_body = player.match(/#{function_name}=function\(a\){(?<body>[^}]+)}/).not_nil!["body"]
|
function_body = player.match(/^#{function_name}=function\(a\){(?<body>[^}]+)}/m).not_nil!["body"]
|
||||||
function_body = function_body.split(";")[1..-2]
|
function_body = function_body.split(";")[1..-2]
|
||||||
|
|
||||||
var_name = function_body[0][0, 2]
|
var_name = function_body[0][0, 2]
|
||||||
|
var_body = player.delete("\n").match(/var #{var_name}={(?<body>(.*?))};/).not_nil!["body"]
|
||||||
|
|
||||||
operations = {} of String => String
|
operations = {} of String => String
|
||||||
matches = player.delete("\n").match(/var #{var_name}={(?<op1>[a-zA-Z0-9]{2}:[^}]+}),(?<op2>[a-zA-Z0-9]{2}:[^}]+}),(?<op3>[a-zA-Z0-9]{2}:[^}]+})};/).not_nil!
|
var_body.split("},").each do |operation|
|
||||||
3.times do |i|
|
op_name = operation.match(/^[^:]+/).not_nil![0]
|
||||||
operation = matches["op#{i + 1}"]
|
op_body = operation.match(/\{[^}]+/).not_nil![0]
|
||||||
op_name = operation[0, 2]
|
|
||||||
|
|
||||||
op_body = operation.match(/\{[^}]+\}/).not_nil![0]
|
|
||||||
case op_body
|
case op_body
|
||||||
when "{a.reverse()}"
|
when "{a.reverse()"
|
||||||
operations[op_name] = "a"
|
operations[op_name] = "a"
|
||||||
when "{a.splice(0,b)}"
|
when "{a.splice(0,b)"
|
||||||
operations[op_name] = "b"
|
operations[op_name] = "b"
|
||||||
else
|
else
|
||||||
operations[op_name] = "c"
|
operations[op_name] = "c"
|
||||||
@ -28,11 +27,10 @@ def fetch_decrypt_function(client, id = "CvFH_6DNRCY")
|
|||||||
|
|
||||||
decrypt_function = [] of {name: String, value: Int32}
|
decrypt_function = [] of {name: String, value: Int32}
|
||||||
function_body.each do |function|
|
function_body.each do |function|
|
||||||
function = function.lchop(var_name + ".")
|
function = function.lchop(var_name).delete("[].")
|
||||||
op_name = function[0, 2]
|
|
||||||
|
|
||||||
function = function.lchop(op_name + "(a,")
|
op_name = function.match(/[^\(]+/).not_nil![0]
|
||||||
value = function.rchop(")").to_i
|
value = function.match(/\(a,(?<value>[\d]+)\)/).not_nil!["value"].to_i
|
||||||
|
|
||||||
decrypt_function << {name: operations[op_name], value: value}
|
decrypt_function << {name: operations[op_name], value: value}
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user