extract_json fix

This commit is contained in:
2026-05-05 03:32:45 -04:00
parent d2b0a414ad
commit 6086c63148
2 changed files with 12 additions and 22 deletions

View File

@@ -553,28 +553,21 @@ class fuckhtml{
case "\"": case "\"":
case "'": case "'":
if( // count preceding backslashes
$i !== 0 && // only check if a quote could be there $bsCount = 0;
( $j = $i - 1;
(
$json[$i - 1] === "\\" && while($j >= 0 && $json[$j] === "\\"){
( $bsCount++;
$i === 2 || $j--;
$json[$i - 2] === "\\" }
)
) || // quote is NOT escaped if even number of backslashes
$json[$i - 1] !== "\\" if($bsCount % 2 === 0){
)
){
// found a non-escaped quote
if($in_quote === null){ if($in_quote === null){
// open quote // open quote
$in_quote = $json[$i]; $in_quote = $json[$i];
}elseif($in_quote === $json[$i]){ }elseif($in_quote === $json[$i]){
// close quote // close quote
$in_quote = null; $in_quote = null;
} }

View File

@@ -347,11 +347,8 @@ class brave{
$q["spellcheck"] = "0"; $q["spellcheck"] = "0";
} }
} }
/*
$handle = fopen("scraper/brave.html", "r");
$html = fread($handle, filesize("scraper/brave.html"));
fclose($handle);*/
//$html = file_get_contents("scraper/brave.html");
try{ try{
$html = $html =
$this->get( $this->get(