From 1062c782ebec95041c5cee289cf59d6ea1bdbe54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Thu, 11 Jan 2024 15:49:17 +0100 Subject: sear.phop --- prog/sear.php/index.php | 21 ++++++++++++--------- prog/sear.php/osdd.xml | 4 ++-- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/prog/sear.php/index.php b/prog/sear.php/index.php index 58d5600..4324fba 100644 --- a/prog/sear.php/index.php +++ b/prog/sear.php/index.php @@ -50,12 +50,12 @@ function query_google ($s, $image = false, $noredirect = false, $bindstring = fa if ($image) { $imageclass = find_class($txtdoc, "{font-family:Roboto,Helvetica,Arial,sans-serif}"); if (!$imageclass) - return ["status" => false, "code" => "noimgclass"]; + return ["status" => false, "code" => "noimgclass", "url" => $url]; } else { $titleclass = find_class($txtdoc, "{color:#1967D2;font-size:14px;line-height:16px}"); $descclass = find_class($txtdoc, "{word-break:break-word}"); if (!$titleclass || !$descclass) - return ["status" => false, "code" => "noclass"]; + return ["status" => false, "code" => "noclass", "url" => $url]; } $results = []; $x = new DOMDocument(); @@ -92,9 +92,12 @@ function query_google ($s, $image = false, $noredirect = false, $bindstring = fa if ($span->getAttribute("class") == $descclass) $breadcrumbs = $span->nodeValue; } - foreach ($a->parentNode->parentNode->getElementsByTagName("table")[0]->getElementsByTagName("span") as $span) - if ($span->getAttribute("class") == $descclass) - $description = $span->nodeValue; + $table = $a->parentNode->parentNode->getElementsByTagName("table")[0]; + $description = "nisem uspel izluščiti opisa."; + if ($table) + foreach ($table->getElementsByTagName("span") as $span) + if ($span->getAttribute("class") == $descclass) + $description = $span->nodeValue; $results[] = ["url" => $hreflink, "title" => $firstspan->nodeValue, "breadcrumbs" => $breadcrumbs, "description" => $description]; } $suggested = []; @@ -108,7 +111,7 @@ function query_google ($s, $image = false, $noredirect = false, $bindstring = fa $suggestion = false; if (sizeof($suggested) == 1 || ($noredirect && sizeof($suggested) > 0)) $suggestion = $suggested[0]; - return ["status" => true, "query" => $s, "suggestion" => $suggestion, "results" => $results]; + return ["status" => true, "query" => $s, "suggestion" => $suggestion, "results" => $results, "url" => $url]; } function template ($title, $queryinfo, $body, $query = "", $additionalform = "", $imgfirst = false) { $query = htmlspecialchars($query); @@ -130,11 +133,11 @@ function template ($title, $queryinfo, $body, $query = "", $additionalform = "", - $title :: sear.c + $title :: sear.php - +
@@ -289,7 +292,7 @@ if (!empty($_REQUEST["f"])) { $add_form .= ""; } if ($q == null) { - die(template("", "iskalnik sear.php", "dobrodošli v iskalniku sear.php, naslednjiku programa sear.c. za iskanje po spletu nekaj vnesite v iskalno vrstico zgoraj in pritisnite na gumb.")); + die(template("", "iskalnik sear.php", "dobrodošli v iskalniku sear.php, nasledniku programa sear.c. za iskanje po spletu nekaj vnesite v iskalno vrstico zgoraj in pritisnite na gumb.")); } $response = try_query_google($q, $image, $exact); if ($response["status"] != true) { diff --git a/prog/sear.php/osdd.xml b/prog/sear.php/osdd.xml index 8ef499d..03b698c 100644 --- a/prog/sear.php/osdd.xml +++ b/prog/sear.php/osdd.xml @@ -1,7 +1,7 @@ - sear.c @ REPLACEME - sear.c @ REPLACEME + sear.php @ REPLACEME + sear.php @ REPLACEME data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////AAAA////////////AAAA/wAAAP////////////////8AAAD/AAAA////////////////////////////////////////////AAAA/////////////////////////////////wAAAP8AAAD//////////////////////////////////////wAAAP//////////////////////////////////////AAAA/wAAAP//////////////////////////////////////AAAA/wAAAP////////////////////////////////8AAAD/AAAA/////////////////////////////////////////////////////////////////////////////////wAAAP8AAAD//////wAAAP8AAAD/AAAA////////////////////////////////////////////////////////////AAAA/wAAAP////////////////8AAAD//////////////////////////////////////////////////////wAAAP///////////////////////////wAAAP///////////////////////////////////////////wAAAP//////////////////////AAAA////////////AAAA/////////////////wAAAP8AAAD///////////8AAAD///////////////////////////8AAAD//////wAAAP///////////wAAAP///////////wAAAP//////AAAA//////////////////////8AAAD///////////8AAAD//////////////////////wAAAP////////////////8AAAD///////////////////////////8AAAD//////////////////////wAAAP///////////wAAAP///////////wAAAP////////////////8AAAD/////////////////////////////////AAAA/wAAAP//////////////////////AAAA/wAAAP8AAAD/////////////////////////////////////////////////////////////////////////////////////////////////////////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== -- cgit v1.2.3