0

I am looking for a way to get an object for a specific video playlist on YouTube using the Zend library. I tried this piece of code:

    $url = 'http://gdata.youtube.com/feeds/api/playlists/'.$_GET['plid'].'?v=2';
    $feed = $yt->getVideoFeed($url);
    $feed->delete();

But delete() apparently isn't a function of getVideoFeed() object. How do I go about making this work?

Thank you in advance.

1 Answers1

0

The YouTube API Developer's Guide for PHP should point you in the right direction.

First, you need to obtain the PlaylistListEntry for the playlist you're interested in, as described at https://developers.google.com/youtube/2.0/developers_guide_php#Retrieving_Playlists

Then, you can call the delete() method on that PlaylistListEntry object: https://developers.google.com/youtube/2.0/developers_guide_php#Deleting_a_Playlist

Jeff Posnick
  • 53,580
  • 14
  • 141
  • 167
  • Thank you for your response! I am using this guide, but I wasn't able to find any way to get PlaylistListEntry object by the playlist's id. Could you please tell me which function I should use to achieve that? – Matěj Voslař Jan 08 '13 at 10:02
  • Hmm, the brute force way would be to iterate over each `PlaylistListEntry` in the `PlaylistListFeed`, and call `getPlaylistId()` on each until you find the one that matches the playlist id you're looking for. There probably is a method to create a `PlaylistListEntry` that corresponds to a given playlist id, but I don't know it off the top of my head. – Jeff Posnick Jan 08 '13 at 17:22
  • I really wanted to avoid the iteration, but it seems to be the only way (as the guides do not describe any way at all). The function will be used very scarcely, so I'll go with it after all. Thank you for your time! – Matěj Voslař Jan 15 '13 at 14:49