From 73681e54c92bde52cb64ca752d189ecc60e27719 Mon Sep 17 00:00:00 2001 From: Eugene Molotov Date: Sat, 5 Oct 2024 12:43:38 +0500 Subject: [PATCH] [RutubeBridge] Correct parsing string in reduxState --- bridges/RutubeBridge.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bridges/RutubeBridge.php b/bridges/RutubeBridge.php index f8e106c8..778ce5af 100644 --- a/bridges/RutubeBridge.php +++ b/bridges/RutubeBridge.php @@ -66,7 +66,15 @@ class RutubeBridge extends BridgeAbstract { $jsonDataRegex = '/window.reduxState = (.*);/'; preg_match($jsonDataRegex, $html, $matches) or returnServerError('Could not find reduxState'); - return json_decode(str_replace('\x', '\\\x', $matches[1])); + $map = [ + '\x26' => '&', + '\x3c' => '<', + '\x3d' => '=', + '\x3e' => '>', + '\x3f' => '?', + ]; + $jsonString = str_replace(array_keys($map), array_values($map), $matches[1]); + return json_decode($jsonString, false); } private function getVideosFromReduxState()