Reputation: 19
I'm attempting to batch delete YouTube videos (playlistItems) from a created playlist. I have an array of playlistitem ids which I loop through and pass each Id as a parameter to the function below.
I get a status 204 response on every single delete... however the videos aren't actually deleted. Rather... only 2 or 3 (if I'm lucky) are deleted. If, for example, I were to try to batch delete 10 videos in a playlist... only 2 or 3 of those videos might actually be deleted. I can continue running my batch delete until, slowly but surely, all the items are deleted... but that seems hardly ideal and an unnecessary waste of quota.
I'm wondering if there's a limit to how quickly I'm allowed to delete playlistItems? And if so, why am I receiving a status 204 when it's clearly failing to delete?
function deleteVideo(id) {
var url = "https://www.googleapis.com/youtube/v3/playlistItems?id="
url += id;
url += "&key=" + oauth2Provider.getApiKey();
return $http({
method: "DELETE",
url: url,
headers: {
"Authorization": "Bearer " + oauth2Provider.getToken()
}
}).then(function successCallback(response) {
console.log(response);
return response;
}, function errorCallback(response) {
console.log(response);
});
}
Upvotes: 0
Views: 118
Reputation: 19
If this is ever helpful to anyone, I believe I later found out that you can't do all the deletes at once asynchronously. You can start off a chain of deletes via async, but each delete must complete before you start the next one in the chain.
Upvotes: 2