query("//div[@id='results']//div[@class='card']") as $result) { $url = $xpath->evaluate(".//a/@href", $result)[0]->textContent; $title = $xpath->evaluate(".//div/@title", $result)[0]->textContent; $views = $xpath->evaluate(".//div/@title", $result)[1]->textContent; $date = $xpath->evaluate(".//div//span", $result)[0]->textContent; $thumbnail_raw1 = $xpath->evaluate(".//div/@style", $result)[0]->textContent; $thumbnail_raw2 = explode("url('", $thumbnail_raw1)[1]; $thumbnail = explode("'), url", $thumbnail_raw2)[0]; $url = check_for_privacy_frontend($url); array_push($results, array ( "title" => htmlspecialchars($title), "url" => htmlspecialchars($url), "base_url" => htmlspecialchars(get_base_url($url)), "views" => htmlspecialchars($views), "date" => htmlspecialchars($date), "thumbnail" => htmlspecialchars($thumbnail) ) ); } return $results; } function print_video_results($results) { echo "
"; foreach($results as $result) { $title = $result["title"]; $url = $result["url"]; $base_url = $result["base_url"]; $views = $result["views"]; $date = $result["date"]; $thumbnail = $result["thumbnail"]; echo "
"; echo ""; echo "$base_url"; echo "

$title

"; echo ""; echo "
"; echo "$date - $views"; echo "
"; echo "
"; } echo "
"; } ?>