if (!empty($videos)) { $videoList = explode(",", $videos); } } else { $videoList = array(); // add video id manually } } try { header('Content-Type: text/html; charset=utf-8'); for ($i = 0; $i < sizeof($videoList); $i++) { $bean = new YouTubeBean(); $bean->setVideoId($videoList[$i]); $bean->setVideoFormat("22"); $bean->setMethod("curl"); $bean->setDestination("/root/Videos/"); // Make sure this folder is writable $downloader = new YouTubeVideoDownloader(); $downloader->startDownload($bean); } } catch (YouTubeInvalidVideoIdException $e) { die("<strong>YouTubeInvalidVideoIdException</strong> : " . $e->getMessage()); } catch (YouTubeUnsupportedVideoFormatException $e) { die("<strong>YouTubeUnsupportedVideoFormatException</strong> : " . $e->getMessage()); } catch (YouTubeUnsupportedDownloadMethodException $e) { die("<strong>YouTubeUnsupportedDownloadMethodException</strong> : " . $e->getMessage()); } catch (YouTubeCurlNotAvailableException $e) { die("<strong>YouTubeCurlNotAvailableException</strong> : " . $e->getMessage()); } catch (YouTubeEmptyDownloadDestinationException $e) { die("<strong>YouTubeEmptyDownloadDestinationException</strong> : " . $e->getMessage()); } catch (YouTubeVideoNotFoundException $e) {