开发者

Check if a video is unlisted on Youtube using Zend

Dear all, I need to know if a video is u开发者_Python百科nlisted through a Zend Framework query. I know there is the read method isVideoPrivate() and the write methods setVideoPublic() and setVideoPrivate() but can't find anything about the unlisted state. Can you help me? thanks


I was troubled at the same point,too. But, I was able to distinguish "public" or "unlisted" by writing as follows.

$videostatus = $videoEntry->extensionElements[6]->extensionAttributes[permission][value];

if($videostatus == 'allowed'){
    $videostatus = 'public';
}elseif($videostatus == 'denied'){
    $videostatus = 'unlisted';
}


Maybe something like this?

try {
        //do stuff with the video
    }
    catch(Zend_Gdata_App_Exception $e) {
        next;
    }
    catch(Zend_Gdata_App_HttpException $httpException) {
        next;
    }
}


maybe try something like that

$permission = $video->extensionElements[5]->extensionAttributes['permission']['value'];
if ($permission == 'denied') {
    $state = 'unlisted';
} else if ($permission == 'allowed' || is_null($permission)) {
    $state = 'public';
}

if you doesn't get the right data on index 5 change to 6;

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜