add support for cucked urls

This commit is contained in:
lolcat committed 2026-11-30 17:19:39 -05:00
1 parent e03c582f74
commit ffb1fc00f3
8 files changed
+223 -318

No files matched your search

+31 -12
View File
@@ -537,7 +537,7 @@ class brave{
$cluster["description"]
)
),
"url" => $cluster["url"],
"url" => $this->convert_goto_to_resolver($cluster["url"]),
"date" => null
];
}
@@ -554,7 +554,7 @@ class brave{
$sublink[] = [
"title" => $this->titledots($r["title"]),
"description" => null,
"url" => $r["url"],
"url" => $this->convert_goto_to_resolver($r["url"]),
"date" => null
];
}
@@ -864,7 +864,7 @@ class brave{
$result["description"]
)
),
"url" => $result["url"],
"url" => $this->convert_goto_to_resolver($result["url"]),
"date" => $date,
"type" => "web",
"thumb" => $thumb,
@@ -954,7 +954,7 @@ class brave{
$description[] = [
"type" => "link",
"url" => $rating["profile"]["url"],
"url" => $this->convert_goto_to_resolver($rating["profile"]["url"]),
"value" => $rating["profile"]["name"]
];
@@ -1006,7 +1006,9 @@ class brave{
$sublink[
$this->fuckhtml->getTextContent($name)
] =
$this->fuckhtml->getTextContent($row["url"]);
$this->fuckhtml->getTextContent(
$this->convert_goto_to_resolver($row["url"])
);
}
}
@@ -1025,7 +1027,7 @@ class brave{
$out["answer"][] = [
"title" => $this->fuckhtml->getTextContent($info["title"]),
"description" => $description,
"url" => $info["url"],
"url" => $this->convert_goto_to_resolver($info["url"]),
"thumb" => $thumb,
"table" => $table,
"sublink" => $sublink
@@ -1077,7 +1079,7 @@ class brave{
"ratio" => null,
"url" => null
],
"url" => $video["url"]
"url" => $this->convert_goto_to_resolver($video["url"])
];
}
}
@@ -1103,7 +1105,7 @@ class brave{
"ratio" => null,
"url" => null
],
"url" => $news["url"]
"url" => $this->convert_goto_to_resolver($news["url"])
];
}
}
@@ -1143,7 +1145,7 @@ class brave{
)
)
),
"url" => $disc["url"],
"url" => $this->convert_goto_to_resolver($disc["url"]),
"date" => isset($disc["age"]) ? strtotime($disc["age"]) : null,
"type" => "web",
"thumb" => [
@@ -1254,7 +1256,7 @@ class brave{
"height" => (int)$result["thumbnail"]["height"]
]
],
"url" => $result["url"]
"url" => $this->convert_goto_to_resolver($result["url"])
];
}
}
@@ -1425,7 +1427,7 @@ class brave{
"duration" => $result["video"]["duration"] == "null" ? null : $this->hms2int($result["video"]["duration"]),
"views" => $result["video"]["views"] == "null" ? null : (int)$result["video"]["views"],
"thumb" => $thumb,
"url" => $result["url"]
"url" => $this->convert_goto_to_resolver($result["url"])
];
}
}
@@ -1571,7 +1573,7 @@ class brave{
"description" => $news["description"],
"date" => !isset($news["age"]) || $news["age"] == "void 0" || $news["age"] == "null" ? null : strtotime($news["age"]),
"thumb" => $thumb,
"url" => $news["url"]
"url" => $this->convert_goto_to_resolver($news["url"])
];
}
}
@@ -2802,6 +2804,23 @@ class brave{
return false;
}
private function convert_goto_to_resolver($url){
if(
preg_match(
'/^\/go\/v1\/([^\/?&]+)/',
$url,
$slug
) === 1
){
return "/resolver?scraper=brave&target={$slug[1]}&sig=" . $this->backend->hmac_sign(4, "brave,{$slug[1]}");
}
// we got a normal URL, yay yipee
return $url;
}
private function detect_captcha(){
$title =