invidious_instance_for_video_results; $url = "$instance_url/api/v1/search?q=$query"; $response = request($url); $json_response = json_decode($response, true); $results = array(); foreach ($json_response as $response) { if ($response["type"] == "video") { $title = $response["title"]; $url = "https://youtube.com/watch?v=" . $response["videoId"]; $url = check_for_privacy_frontend($url); $uploader = $response["author"]; $views = $response["viewCount"]; $date = $response["publishedText"]; $thumbnail = $instance_url . "/vi/" . explode("/vi/" ,$response["videoThumbnails"][4]["url"])[1]; array_push($results, array ( "title" => htmlspecialchars($title), "url" => htmlspecialchars($url), "base_url" => htmlspecialchars(get_base_url($url)), "uploader" => htmlspecialchars($uploader), "views" => htmlspecialchars($views), "date" => htmlspecialchars($date), "thumbnail" => htmlspecialchars($thumbnail) ) ); } } return $results; } function print_video_results($results) { echo "