instances); $instance = $config->instances[$num]; $url = "https://$instance/api.php"; // API POST field $post_string = "q=$query&t=2"; // alternative frontends // fuck the cookie abuse in API if (!isset($_COOKIE["disable_frontends"])) { if (isset($_COOKIE["invidious"])) $cookies=array("invidious"=>$_COOKIE["invidious"]); else if (!empty($config->frontends["invidious"]["instance_url"])) $cookies=array("invidious"=>$config->frontends["invidious"]["instance_url"]); else $cookies=array("invidious"=>null); } else $cookies=array("disable_frontends"=>$_COOKIE["disable_frontends"]); $api_ch = curl_init($url); curl_setopt_array($api_ch, $config->curl_settings); curl_setopt($api_ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($api_ch, CURLOPT_COOKIE, http_build_query($cookies, '', ';')); curl_setopt($api_ch, CURLOPT_POSTFIELDS, $post_string); $results = json_decode(curl_exec($api_ch),true); if($results == null) $results = "$instance is broken"; return $results; } function print_video_results($results) { echo "