From 4042b54afbbc596b3adbe5cff020cb4a6ddf4b85 Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Tue, 24 Jul 2018 17:04:49 -0500 Subject: [PATCH] Add fix for function names with numbers in them --- src/invidious/helpers.cr | 4 ++-- 1 file 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="(?\/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,(?[a-zA-Z]{2})\(c\)\)\)/).not_nil!["name"] + function_name = player.match(/\(b\|\|\(b="signature"\),d.set\(b,(?[a-zA-Z0-9]{2})\(c\)\)\)/).not_nil!["name"] function_body = player.match(/#{function_name}=function\(a\){(?[^}]+)}/).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}={((?[a-zA-Z]{2}:[^}]+})),((?[a-zA-Z]{2}:[^}]+})),((?[a-zA-Z]{2}:[^}]+}))};/).not_nil! + matches = player.delete("\n").match(/var #{var_name}={(?[a-zA-Z0-9]{2}:[^}]+}),(?[a-zA-Z0-9]{2}:[^}]+}),(?[a-zA-Z0-9]{2}:[^}]+})};/).not_nil! 3.times do |i| operation = matches["op#{i + 1}"] op_name = operation[0, 2]