yt = new Zend_Gdata_YouTube(); //$yt = new Zend_Gdata_YouTube("", 'Studentia', "", "AI39si4qPrwBApcPS9ns7-Zp3nBgXIewu41Z05cLkxIaVNiKKeRN8N9OthD6v1zPIpYKjqN90HsWQlBrxb1W0QwcNz4VSfdH4Q"); $this->yt->setMajorProtocolVersion(2); if($isUrl) { $this->url = $param; $this->id = $this->url2id(); } else { $this->id = $param; $this->url = "http://www.youtube.com/watch?v=".$this->id; } } public function load() { $this->videoEntry = $this->yt->getVideoEntry($this->id); if(!$this->videoEntry) throw new Exception("Video $this->id does not exist or Error in Youtube API communication"); else if(!$this->videoEntry->isVideoEmbeddable()) { throw new Exception("Das Video ".$this->id." ".$this->getVideoTitle()." kann nur auf YoTube angesehen werden."); } } public function url2id() { $aux = explode("?",$this->url); $aux2 = explode("&",$aux[1]); foreach($aux2 as $campo => $valor) { $aux3 = explode("=",$valor); if($aux3[0] == 'v') $video = $aux3[1]; } $this->id = $video; if(!$this->id) throw new Exception("Miss formated URL given! ".$this->url); return $this->id; } public function thumb_url($tamanho=NULL) { $tamanho = $tamanho == "maior"?"hq":""; return 'http://i1.ytimg.com/vi/'.$this->id.'/'.$tamanho.'default.jpg'; } public function getVideoId() { return $this->videoEntry->getVideoId(); } public function getRelatedVideos() { return $this->yt->getRelatedVideoFeed($this->getVideoId()); } public function getVideoTitle() { return utf8_decode($this->videoEntry->getVideoTitle()); } public function getVideoDescription() { return utf8_decode($this->videoEntry->getVideoDescription()); } public function getVideoTags() { return $this->videoEntry->getVideoTags(); } public function getVideoDuration() { return $this->videoEntry->getVideoDuration(); } public function getVideoCategory() { return utf8_decode($this->videoEntry->getVideoCategory()); } public function player($width,$height) { $this->url2id(); return ''; } }?>