/** * Delete a video matching a developer tag and a video id. * * @param $youTubeService Zend_Gdata_YouTube An authenticated YouTube service object. * @param $developerTag string A developer tag for which to retrieve videos. * @param $videoIdsToDelete array An array of video ids to be deleted. * @return void */ function deleteVideosByDeveloperTag($youTubeService, $developerTag, $videoIdsToDelete) { $devTagUrl = 'http://gdata.youtube.com/feeds/videos/-/%7B' . 'http%3A%2F%2Fgdata.youtube.com%2Fschemas%2F2007%2F' . 'developertags.cat%7D' . $developerTag; $devTagFeed = $youTubeService->getVideoFeed($devTagUrl); foreach($developerTagFeed as $videoEntry) { if ($entry instanceof Zend_Gdata_YouTube_VideoEntry) { $videoIdsToBeDeleted[] = $videoEntry->getVideoId(); } } // Then use a read-write feed to actually perform the deletion(s) $myVideoFeed = $youTubeService->getUserUploads('default'); foreach($myVideoFeed as $videoEntry) { $id = $videoEntry->getVideoId(); if (in_array($id, $videoIdsToBeDeleted) { $youTubeService->delete($videoEntry); } } }
Deleting Video Entrys based on Video ID and Developer Key
Posted by
Jochen Hartmann (Google)
on
Monday, July 28, 2008
A quick helper function explaining how to delete Video Entry's from YouTube based on a Developer Tag and based on an array of Video ID's to delete. Please note that this example assumes the use of the PHP Client Library.
Subscribe to:
Post Comments (Atom)
4 comments:
Such as with other feed functions, this is useless since it only lists last 25 videos...
line 15 # $devTagFeed = $youTubeService->getVideoFeed($devTagUrl);
line 17 # foreach($developerTagFeed ...
Shouldn't the array in de foreach be called $devTagFeed instead of $developerTagFeed
line 28 # if (in_array($id, $videoIdsToBeDeleted) {
should be
if (in_array($id, $videoIdsToBeDeleted)) {
one ")" missing
healthtips
healthtips
healthtips
healthtips
healthtips
socks proxy
socks proxy
socks proxy
socks proxy
socks proxy
socks proxy
socks proxy
socks proxy
socks proxy
socks proxy
check socks proxy
socks proxy
socks proxy
funnystory
funnystory
funnystory
funnystory
funnystory
funny pictures
funny pictures
funny pictures
funny pictures
funny pictures
funny pictures
Girl Xinh
Girl Xinh
Girl Xinh
Girl Xinh
Girl Xinh
Girl Xinh
Girl Xinh
cute animal
food news
internet
football news
bank news
marketing
science news
travel vietnamt
real estate vietnam
business news
music news
health news
software
seo news
Post a Comment