diff --git a/src/consts.rs b/src/consts.rs index 64654b4..cc697b7 100644 --- a/src/consts.rs +++ b/src/consts.rs @@ -34,7 +34,7 @@ pub static REGEX_SIGNATURE_FUNCTION: Lazy = Lazy::new(|| { r#")"# )).unwrap() }); -pub static REGEX_HELPER_OBJ_NAME: &Lazy = regex!(r"([A-Za-z0-9_\$]{1,})=function\("); +pub static REGEX_HELPER_OBJ_NAME: &Lazy = regex!(r"function\(([a-zA-Z_$][a-zA-Z0-9_$]*)\)|([a-zA-Z_$][a-zA-Z0-9_$]*)\.[A-Za-z_$]"); pub static NSIG_FUNCTION_NAME: &str = "decrypt_nsig"; pub static SIG_FUNCTION_NAME: &str = "decrypt_sig"; diff --git a/src/player.rs b/src/player.rs index 40d8ad2..431d283 100644 --- a/src/player.rs +++ b/src/player.rs @@ -182,10 +182,9 @@ pub async fn fetch_update(state: Arc) -> Result<(), FetchUpdateStat // Get the helper object let helper_object_name = REGEX_HELPER_OBJ_NAME .captures(sig_function_body) - .unwrap() - .get(1) - .unwrap() - .as_str(); + .and_then(|cap| cap.get(1).or_else(|| cap.get(2))) + .map(|m| m.as_str()) + .unwrap_or_default(); let mut helper_object_body_regex_str = String::new(); helper_object_body_regex_str += "(var ";