query("//div[@id='search']//div[contains(@class, 'g')]") as $result) { $url = $xpath->evaluate(".//a/@href", $result)[0]; if ($url == null) continue; if (!empty($results)) // filter duplicate results if (end($results)["url"] == $url->textContent) continue; $url = $url->textContent; if (!$config_disable_privacy_friendly_frontends) $url = check_for_privacy_friendly_alternative($url); $title = $xpath->evaluate(".//h3", $result)[0]; array_push($results, array ( "title" => htmlspecialchars($title->textContent), "url" => htmlspecialchars($url), "base_url" => htmlspecialchars(get_base_url($url)) ) ); } return $results; } function print_video_results($results) { echo "