Batch Delete Videos From YouTube Favorites Playlist -
i trying batch delete videos user youtube favorites using youtube v2 api. (see https://developers.google.com/youtube/2.0/developers_guide_protocol_batch_processing)
posting videos favorites in batch works nicely; , can remove single videos favorites without problem (this rules out problem authentication).
my request body follows, videoid1
, videoid2
<yt:favoriteid>
ids found in corresponding video xml:
<?xml version="1.0" encoding="utf-8"?> <feed xmlns='http://www.w3.org/2005/atom' xmlns:media='http://search.yahoo.com/mrss/' xmlns:batch='http://schemas.google.com/gdata/batch' xmlns:yt='http://gdata.youtube.com/schemas/2007'> <batch:operation type="delete"/> <entry><id>videoid1</id></entry> <entry><id>videoid2</id></entry> </feed>
this response however, userid
ofcourse userid of user , batchid
batchid given service:
<?xml version='1.0' encoding='utf-8'?> <feed xmlns='http://www.w3.org/2005/atom'> <id>https://gdata.youtube.com/feeds/api/users/userid/favorites/batch/batchid</id> <updated>2014-01-31t14:50:54.948z</updated> <category scheme='http://schemas.google.com/g/2005#kind' term='http://gdata.youtube.com/schemas/2007#favorite'/> <title>batch feed</title> <entry xmlns:batch='http://schemas.google.com/gdata/batch'> <id>videoid1</id> <updated>2014-01-31t14:50:54.948z</updated> <title>error</title> <content>invalid entry id/uri</content> <batch:status code='400' reason='invalid entry id/uri'/> </entry> <entry xmlns:batch='http://schemas.google.com/gdata/batch'> <id>videoid2</id> <updated>2014-01-31t14:50:54.949z</updated> <title>error</title> <content>invalid entry id/uri</content> <batch:status code='400' reason='invalid entry id/uri'/> </entry> </feed>
it states invalid entry id/uri
videos try remove, while when remove them singular delete request same id, works.
is batch deleting videos favorites not supported, or missing something?
i've got work, question , answer: batch deleting videos using youtube api , httpwebrequest
the trick using user userid
instead of default
, , use complete video url id
.
the batch url looks this:
https://gdata.youtube.com/feeds/api/users/userid/favorites/batch?v=2&alt=json
the request looks this:
<?xml version="1.0" encoding="utf-8"?> <feed xmlns='http://www.w3.org/2005/atom' xmlns:media='http://search.yahoo.com/mrss/' xmlns:batch='http://schemas.google.com/gdata/batch' xmlns:yt='http://gdata.youtube.com/schemas/2007'> <batch:operation type="delete"/> <entry> <id>https://gdata.youtube.com/feeds/api/users/userid/favorites/videoid1?v=2</id> </entry> <entry> <id>https://gdata.youtube.com/feeds/api/users/userid/favorites/videoid2?v=2</id> </entry> </feed>
Comments
Post a Comment