Wednesday, January 18, 2012

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

Hello Martti,

I'm not sure without doing a lot of digging, but you could take
advantage of the fact that the edit URL for adding videos to a
playlist is well-defined, and is documented at

http://code.google.com/apis/youtube/2.0/developers_guide_protocol_playlists.html#Adding_a_video_to_a_playlist

It's always going to be https://gdata.youtube.com/feeds/api/playlists/PLAYLIST_ID

Cheers,
-Jeff Posnick, YouTube API Team
groups.google.com/group/youtube-api-gdata | apiblog.youtube.com |
@YouTubeDev


On Jan 15, 11:17 am, Martti Laine <marttilain...@gmail.com> wrote:
> 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 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