Sunday, January 15, 2012

[YouTube-API] Add a video to playlist doesn't work

Hey guys. Do you know what I'm doing wrong? $playlist->getPlaylistVideoFeedUrl() returns NULL

$feed = $yt->getVideoFeed('http://gdata.youtube.com/feeds/api/playlists/'.$input['id'].'?v=2');
$playlist
= new Zend_Gdata_YouTube_PlaylistListEntry($feed->getDOM());

foreach($playlist as $video) {
  $id
= $video->getVideoId();
  $video_ids
[] = $id;
 
if(!in_array($id,$new_videos)) {
   
/* Remove the video */
 
}
}

$post_url
= $playlist->getPlaylistVideoFeedUrl();
foreach(array_diff($new_videos,$video_ids) as $new_video) {
  $video_entry
= $yt->getVideoEntry($new_video);
  $playlist_entry
= $yt->newPlaylistListEntry($video_entry->getDOM());
  $yt
->insertEntry($playlist_entry,$post_url);
}

Any help is appreciated

--
You received this message because you are subscribed to the Google Groups "YouTube APIs Developer Forum" group.
To view this discussion on the web visit https://groups.google.com/d/msg/youtube-api-gdata/-/JBQUuUuEESAJ.
To post to this group, send email to youtube-api-gdata@googlegroups.com.
To unsubscribe from this group, send email to youtube-api-gdata+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/youtube-api-gdata?hl=en.

No comments:

Post a Comment