summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOmar Roth <omarroth@hotmail.com>2018-07-24 17:04:49 -0500
committerOmar Roth <omarroth@hotmail.com>2018-07-24 17:04:49 -0500
commit4042b54afbbc596b3adbe5cff020cb4a6ddf4b85 (patch)
treec8aa328e959978d853cb65e6804c76bdb7e65217
parent115a8155285a37fe70d3925a5b3b3a6956265d28 (diff)
downloadinvidious-4042b54afbbc596b3adbe5cff020cb4a6ddf4b85.tar.gz
invidious-4042b54afbbc596b3adbe5cff020cb4a6ddf4b85.tar.bz2
invidious-4042b54afbbc596b3adbe5cff020cb4a6ddf4b85.zip
Add fix for function names with numbers in them
-rw-r--r--src/invidious/helpers.cr4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/invidious/helpers.cr b/src/invidious/helpers.cr
index 184b4f08..05823764 100644
--- a/src/invidious/helpers.cr
+++ b/src/invidious/helpers.cr
@@ -353,14 +353,14 @@ def update_decrypt_function(client)
url = document.match(/src="(?<url>\/yts\/jsbin\/player-.{9}\/en_US\/base.js)"/).not_nil!["url"]
player = client.get(url).body
- function_name = player.match(/\(b\|\|\(b="signature"\),d.set\(b,(?<name>[a-zA-Z]{2})\(c\)\)\)/).not_nil!["name"]
+ function_name = player.match(/\(b\|\|\(b="signature"\),d.set\(b,(?<name>[a-zA-Z0-9]{2})\(c\)\)\)/).not_nil!["name"]
function_body = player.match(/#{function_name}=function\(a\){(?<body>[^}]+)}/).not_nil!["body"]
function_body = function_body.split(";")[1..-2]
var_name = function_body[0][0, 2]
operations = {} of String => String
- matches = player.delete("\n").match(/var #{var_name}={((?<op1>[a-zA-Z]{2}:[^}]+})),((?<op2>[a-zA-Z]{2}:[^}]+})),((?<op3>[a-zA-Z]{2}:[^}]+}))};/).not_nil!
+ 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!
3.times do |i|
operation = matches["op#{i + 1}"]
op_name = operation[0, 2]