[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.
This commit is contained in:
Eugene Molotov 2022-08-05 14:45:50 +05:00 committed by GitHub
parent 3984427f44
commit 205f0a7239
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -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]));
}