public function download($itag=null, $resume=false, $caption=false)
	{
		if ($itag === null && $this->defaultItag !== null) $itag = $this->defaultItag;
		if (!$this->isPlaylist) {
			try {
				$this->getVideoInfo(true);
				$this->downloadVideo($itag, $resume, $caption);
			} catch (YoutubeException $e) {
				throw $e;
			}
		} else {
			$i = 1;
			foreach ($this->playlistInfo->video as $video)
			{
				$this->currentDownloadingVideoIndex = $i++;
				$this->videoId = $video->encrypted_id;
				try {
					$this->getVideoInfo(true);
				} catch (YoutubeException $e) {
					throw $e;
				}

				try {
					$this->downloadVideo($itag, $resume, $caption);
				} catch (YoutubeException $e) {
					throw $e;
				}
			}
		}
	}