YouTube Zend Library Gets VideoId Records in Playlist

I use the Zend GData library to control YouTube videos from my application. The app gives the user the ability to add the downloaded video to one of their previously existing YouTube playlists, if they so wish. One of the problems is that if a video is subsequently deleted from our application, it seems to leave the β€œlost” remote video object in the playlist to which it was added.

I tried to figure out how our app deletes videos from any playlists before deleting it from YouTube, but it's hard for me to figure out how to determine if a particular YouTube video is contained in playlists.

I wrote a function that iterates over each entry in each playlist pertaining to a registered user and tries to compare the identifier of the video in the playlist with the identifier of the video that was passed as an argument. However, I cannot get the value for the video ID for any of the videos in the playlists.

Here's the function:

function remove_video_from_playlists($yt,$hash){ $playlistListFeed = $yt->getPlaylistListFeed("default"); foreach ($playlistListFeed as $playlistListEntry) { $playlistVideoFeed = $yt->getPlaylistVideoFeed($playlistListEntry->getPlaylistVideoFeedUrl()); foreach ($playlistVideoFeed as $playlistVideoEntry) { //check to see if each video in the playlist matches the video we are trying to delete if($playlistVideoEntry->getMediaGroup()->videoId == $hash){ $playlistVideoEntry->delete(); } } } } 

Any help would be greatly appreciated. How to get a basic video image of each video in playlists?

+4
source share
2 answers

I found a problem.

I needed to install the version 2 of the GData library on the $ yt object

The following is used: $ Yt-> setMajorProtocolVersion (2);

This made all the strange behavior disappear, and using $ playlistVideoEntry-> getMediaGroup () β†’ getVideoId () worked properly.

+1
source

Have you tried to do

 $playlistVideoEntry->getMediaGroup()->getVideoId(); 

Because, looking in the API, it seems that there is such a function that should return exactly what you need.

0
source

All Articles