コード例 #1
0
ファイル: example.php プロジェクト: manishkhanchandani/mkgxy
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;
}
コード例 #2
0
ファイル: Bug9917.php プロジェクト: manishkhanchandani/mkgxy
 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;
     }
 }
コード例 #3
0
 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;
     }
 }