Cloudkuimages - YouTube Downloader

Search Results:'; foreach ($data['result'] as $video) { echo '
'; echo 'Thumbnail'; echo '

' . $video['title'] . '

'; echo '
'; echo '
'; } } else { echo '

No results found.

'; } } if (isset($_GET['url']) && isset($_GET['type'])) { $url = $_GET['url']; $type = $_GET['type']; $downloadUrl = "$downloadApi?url=" . urlencode($url) . "&apikey=$apiKey"; $response = file_get_contents($downloadUrl); $data = json_decode($response, true); if ($data['status'] && isset($data['result'][$type])) { $fileUrl = $data['result'][$type]; $ext = $type === 'mp3' ? 'mp3' : 'mp4'; $uploadDir = $type === 'mp3' ? 'uploads/audios/' : 'uploads/videos/'; if (!is_dir($uploadDir)) { mkdir($uploadDir, 0777, true); } // Create a clean hash for the filename $fileName = basename(parse_url($fileUrl, PHP_URL_PATH)); $fileName = preg_replace('/[^a-zA-Z0-9-_\.]/', '', $fileName); // Remove unwanted characters // Hash the file name $fileName = md5($fileName) . '.' . $ext; $filePath = $uploadDir . $fileName; file_put_contents($filePath, file_get_contents($fileUrl)); $serverFilePath = 'https://' . $_SERVER['HTTP_HOST'] . '/' . $filePath; echo '

Download completed! Click here to download ' . $ext . '

'; // Show checkmark animation echo '
✔
Download successful!
Close
'; } else { echo '

Download failed. Please try again.

'; } } ?>