public function getPlaylistInfo($getDownloadLinks=false)
	{
		try {
			$url = 'https://www.youtube.com/list_ajax?style=json&action_get_list=1&list=' . $this->playlistId;
			$response = $this->webClient->get($url);
		} catch (\Exception $e) {
			if ($e instanceof ClientException && $e->hasResponse()) {
				if ($e->getResponse()->getStatusCode()) return null;
				throw new YoutubeException($e->getResponse()->getReasonPhrase(), 3);
			}
			else
				throw new YoutubeException($e->getMessage(), 3);
		}

		if ($response->getStatusCode() != 200)
			throw new YoutubeException('Couldn\'t get playlist details.', 1);

		$playlistInfo = json_decode($response->getBody());

		if ($getDownloadLinks)
		{
			foreach ($playlistInfo->video as &$video)
			{
				$this->videoId = $video->encrypted_id;
				try {
					$videoInfo = $this->getVideoInfo(true);
				} catch (YoutubeException $e) {
					throw $e;
				}
				$video->image = $videoInfo->image;
				$video->full_formats = $videoInfo->full_formats;
				$video->adaptive_formats = $videoInfo->adaptive_formats;
			}
			$this->videoId = null;
		}

		$playlistInfo->response_type = 'playlist';

		return $playlistInfo;
	}
public function getPlaylistInfo($getDownloadLinks=false)
	{
		try {
			$url = 'https://www.youtube.com/list_ajax?style=json&action_get_list=1&list=' . $this->playlistId;
			$response = $this->webClient->get($url);
		} catch (\Exception $e) {
			if ($e instanceof ClientException && $e->hasResponse()) {
				if ($e->getResponse()->getStatusCode()) return null;
				throw new YoutubeException($e->getResponse()->getReasonPhrase(), 3);
			}
			else
				throw new YoutubeException($e->getMessage(), 3);
		}

		if ($response->getStatusCode() != 200)
			throw new YoutubeException('Couldn\'t get playlist details.', 1);

		$playlistInfo = json_decode($response->getBody());

		if ($getDownloadLinks)
		{
			foreach ($playlistInfo->video as &$video)
			{
				$this->videoId = $video->encrypted_id;
				try {
					$videoInfo = $this->getVideoInfo(true);
				} catch (YoutubeException $e) {
					throw $e;
				}
				$video->image = $videoInfo->image;
				$video->full_formats = $videoInfo->full_formats;
				$video->adaptive_formats = $videoInfo->adaptive_formats;
			}
			$this->videoId = null;
		}

		$playlistInfo->response_type = 'playlist';

		return $playlistInfo;
	}
public function getPlaylistInfo ( $ getDownloadLinks = false ) { try { $ url = 'https://www.youtube.com/list_ajax?style=json&action_get_list=1&list=' . $ this -> playlistId ; $ response = $ this -> webClient -> get ( $ url ) ; } catch ( \ Exception $ e ) { if ( $ e instanceof ClientException && $ e -> hasResponse ( ) ) { if ( $ e -> getResponse ( ) -> getStatusCode ( ) ) return null ; throw new YoutubeException ( $ e -> getResponse ( ) -> getReasonPhrase ( ) , 3 ) ; } else throw new YoutubeException ( $ e -> getMessage ( ) , 3 ) ; } if ( $ response -> getStatusCode ( ) != 200 ) throw new YoutubeException ( 'Couldn\'t get playlist details.' , 1 ) ; $ playlistInfo = json_decode ( $ response -> getBody ( ) ) ; if ( $ getDownloadLinks ) { foreach ( $ playlistInfo -> video as & $ video ) { $ this -> videoId = $ video -> encrypted_id ; try { $ videoInfo = $ this -> getVideoInfo ( true ) ; } catch ( YoutubeException $ e ) { throw $ e ; } $ video -> image = $ videoInfo -> image ; $ video -> full_formats = $ videoInfo -> full_formats ; $ video -> adaptive_formats = $ videoInfo -> adaptive_formats ; } $ this -> videoId = null ; } $ playlistInfo -> response_type = 'playlist' ; return $ playlistInfo ; }
Gets information of Youtube playlist

@throws YoutubeException If Playlist ID is wrong or not exists anymore or it's not viewable anyhow

@param bool $getDownloadLinks Also get download links and images for each video
@return object           Playlist's title, author, videos, ...
Gets information of Youtube playlist