remove tracking links on video search using euroshit proxies

This commit is contained in:
2026-08-27 19:05:18 -04:00
parent 89051f0129
commit d7bb0755cb

View File

@@ -1581,8 +1581,7 @@ class google{
implode(",", $tbs);
}
}
//$html = file_get_contents("scraper/google.html");
$data = $this->get(
$proxy,
"https://www.google.com/search",
@@ -1593,6 +1592,8 @@ class google{
$html = &$data["data"];
$container = &$data["container"];
//$html = file_get_contents("scraper/google.html");
if(!isset($params["start"])){
$params["start"] = 0;
@@ -1635,6 +1636,29 @@ class google{
$params["c"] = $container;
// get encoded links
$encoded_links =
explode(
"function(){var m={",
$html,
2
);
if(count($encoded_links) === 2){
$encoded_links =
json_decode(
$this->fuckhtml
->extract_json(
"{" . $encoded_links[1]
),
true
);
}else{
$encoded_links = [];
}
$out = [
"status" => "ok",
"npt" =>
@@ -1813,6 +1837,50 @@ class google{
}
}
$url =
$this->fuckhtml
->getTextContent(
$url[0]["attributes"]["href"]
);
if(
preg_match(
'/^\/goto\?url/',
$url
)
){
// encrypted url detected
// get reference div
$refdivs =
$this->fuckhtml
->getElementsByAttributeName(
"id",
"div"
);
foreach($refdivs as $r){
if(
preg_match(
'/^atritem-/',
$r["attributes"]["id"]
) &&
isset($r["attributes"]["jsdata"])
){
$ref = explode(";", $r["attributes"]["jsdata"]);
$ref = $ref[count($ref) - 1];
if(isset($encoded_links[$ref][32][11][7])){
$url = $encoded_links[$ref][32][11][7];
}
break;
}
}
}
$out["video"][] = [
"title" =>
$this->titledots(
@@ -1831,11 +1899,7 @@ class google{
"duration" => $duration,
"views" => null,
"thumb" => $thumb,
"url" =>
$this->fuckhtml
->getTextContent(
$url[0]["attributes"]["href"]
)
"url" => $url
];
}