From 205f0a7239cc924638437d8bb0cf5bf322ee8008 Mon Sep 17 00:00:00 2001 From: Eugene Molotov Date: Fri, 5 Aug 2022 14:45:50 +0500 Subject: [PATCH] [RutubeBridge] Fix regex for retreiving reduxState (#2955) Before this commit regex captured window.reduxState value until first semicolon. This is incorrect since it produces invalid json, if semicolon is also somethere in the middle of stringified json. After this commit regex will capture window.reduxState value until last semicolon. --- bridges/RutubeBridge.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bridges/RutubeBridge.php b/bridges/RutubeBridge.php index 6e2559d2..4a661afb 100644 --- a/bridges/RutubeBridge.php +++ b/bridges/RutubeBridge.php @@ -55,7 +55,7 @@ class RutubeBridge extends BridgeAbstract private function getJSONData($html) { - $jsonDataRegex = '/window.reduxState = (.*?);/'; + $jsonDataRegex = '/window.reduxState = (.*);/'; preg_match($jsonDataRegex, $html, $matches) or returnServerError('Could not find reduxState'); return json_decode(str_replace('\x', '\\\x', $matches[1])); }