function getTaggedVideos($tag, $page) { if (is_array($tag)) { $tag = implode(" ", $tag); } $youtube = new Services_YouTube(DEV_ID); $response = $youtube->listByTag($tag, $page, 25); if (isset($response->error)) { throw new Services_YouTube_Exception($response->error->description); } return $response; }
public function test9917() { try { $user_id = "ganchiku"; $youtube = new Services_YouTube(self::DEV_ID, array('usesCache' => true)); $youtube->setDriver('xmlrpc'); $user = $youtube->getProfile($user_id); $this->assertEquals('Shin', $user->user_profile->first_name); $this->assertEquals('Ohno', $user->user_profile->last_name); } catch (Services_YouTube_Exception $e) { echo $e; } }
public function testListFeatured() { try { $youtube = new Services_YouTube(self::DEV_ID); $youtube->setUseCache(true); $data = $youtube->listFeatured(); $videos = $data->xpath('//video'); $this->assertEquals(25, count($videos)); // Array Response $youtube->setResponseFormat('array'); $data = $youtube->listFeatured(); $this->assertEquals(25, count($data['video_list']['video'])); // XML_RPC driver $youtube->setDriver('xmlrpc'); $youtube->setUseCache(false); $youtube->setResponseFormat('object'); $data = $youtube->listFeatured(); $videos = $data->xpath('//video'); $this->assertEquals(25, count($videos)); } catch (Services_YouTube_Exception $e) { print $e; } }