I am using the test code found @ http://code.google.com/apis/youtube/2.0/developers_guide_php.html to create a playlist:
$newPlaylist = $yt->newPlaylistListEntry();
$newPlaylist->summary = $yt->newDescription()->setText($desc);
$newPlaylist->title = $yt->newTitle()->setText($title);
// post the new playlist
$postLocation = 'http://gdata.youtube.com/feeds/api/users/default/playlists';
try {
$playlist = $yt->insertEntry($newPlaylist, $postLocation);
}
catch (Zend_Gdata_App_Exception $e) {
echo $e->getMessage();
}
The playlist is created, but how can I get the id or url of the playlist that was just created?
I have the same problem. I have managed to get a bit further but I still can't get the playlistID. Here is what I did:
instead of:
$playlist = $yt->insertEntry($newPlaylist, $postLocation);
I used :
$playlist = $yt->insertEntry($newPlaylist, $postLocation, 'Zend_Gdata_YouTube_PlaylistListEntry');
But when I try to get the id by $playlist->getPlaylistID() or $playlist->playlistId->text I get the same exception which says :
The yt:playlistId element is not supported in versions earlier than 2.
even if I have set it earlier with $yt->setMajorProtocolVersion(2);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With