remove tracking links on video search using euroshit proxies
This commit is contained in:
+71
-7
@@ -1581,8 +1581,7 @@ class google{
|
|||||||
implode(",", $tbs);
|
implode(",", $tbs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//$html = file_get_contents("scraper/google.html");
|
|
||||||
$data = $this->get(
|
$data = $this->get(
|
||||||
$proxy,
|
$proxy,
|
||||||
"https://www.google.com/search",
|
"https://www.google.com/search",
|
||||||
@@ -1593,6 +1592,8 @@ class google{
|
|||||||
$html = &$data["data"];
|
$html = &$data["data"];
|
||||||
$container = &$data["container"];
|
$container = &$data["container"];
|
||||||
|
|
||||||
|
//$html = file_get_contents("scraper/google.html");
|
||||||
|
|
||||||
if(!isset($params["start"])){
|
if(!isset($params["start"])){
|
||||||
|
|
||||||
$params["start"] = 0;
|
$params["start"] = 0;
|
||||||
@@ -1635,6 +1636,29 @@ class google{
|
|||||||
|
|
||||||
$params["c"] = $container;
|
$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 = [
|
$out = [
|
||||||
"status" => "ok",
|
"status" => "ok",
|
||||||
"npt" =>
|
"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"][] = [
|
$out["video"][] = [
|
||||||
"title" =>
|
"title" =>
|
||||||
$this->titledots(
|
$this->titledots(
|
||||||
@@ -1831,11 +1899,7 @@ class google{
|
|||||||
"duration" => $duration,
|
"duration" => $duration,
|
||||||
"views" => null,
|
"views" => null,
|
||||||
"thumb" => $thumb,
|
"thumb" => $thumb,
|
||||||
"url" =>
|
"url" => $url
|
||||||
$this->fuckhtml
|
|
||||||
->getTextContent(
|
|
||||||
$url[0]["attributes"]["href"]
|
|
||||||
)
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user