使用 YouTube API 和 HTTpWebRequest 批量删除视频 [英] Batch deleting videos using YouTube API and HTTpWebRequest

查看:30
本文介绍了使用 YouTube API 和 HTTpWebRequest 批量删除视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这上面花了将近 10 个小时,但仍然没有运气,只有错误.

I've spent almost 10 hours on this, and still no luck, only errors.

我正在尝试使用 YouTube API 和 c# .net 中的 HttpWebRequest 批量删除 2 个视频(我没有使用默认的 api dll)

I am trying to delete 2 videos in batch, using the YouTube API and HttpWebRequest in c# .net (I am not using the default api dll)

我将请求(使用 POST)发送到:http://gdata.youtube.com/feeds/api/users/default/uploads/batch?v=2

I am sending the request (with POST) to: http://gdata.youtube.com/feeds/api/users/default/uploads/batch?v=2

这是我发送的 xml 请求:

Here is the xml request I am sending:

<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'>
<entry>
<batch:operation type="delete"/>
<id>http://gdata.youtube.com/feeds/api/users/default/uploads/Fe-Wzz4thKk</id>
</entry>
</feed>

我收到错误:无效的条目 ID/Uri

I am getting the error: Invalid entry Id/Uri

我也尝试只发送视频的 ID,但仍然没有运气,只有错误.我该怎么办?这真的很令人沮丧,因为我找不到任何删除视频(不是播放列表)的示例.

I also tried to send only the ID of the video but still no luck, only errors. What can I do about this ? It's really frustrating because I can't find any examples of deleting videos (not playlists).

希望有人能帮忙.

谢谢!弗拉德

我还尝试将 POST 数据发送到:

I also tried to send the POST data to:

http://gdata.youtube.com/feeds/api/视频/批次?v=2

和数据:

 <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'>
<entry>
<batch:operation type="delete"/>
<id>http://gdata.youtube.com/feeds/api/videos/Fe-Wzz4thKk</id>
</entry>
</feed>

这个错误是:此供稿是只读的

The error with this was: This feed is read-only

我与好用户一起记录了它(我测试了上传视频和其他内容并且可以正常工作).

I am logged it with the good user (I tested uploading videos and other stuff and it works).

推荐答案

我想让你们现在我破解了这个.答案很简单.

I want to let you guys now I cracked this. The answer is pretty simple.

首先,请求是:

http://gdata.youtube.com/feeds/api/users/ACCOUNT_CHANNEL_NAME/uploads/batch?v=2

而不是:

http://gdata.youtube.com/feeds/api/users/default/uploads/batch?v=2

所以你不能使用default"关键字.我认为这是唯一不起作用的地方.

So you cannot use the "default" keyword. I think it's the only place where it does not work.

此外,每个元素的 .. 应该如下所示:

Also, the .. of every element should look like this:

<id>http://gdata.youtube.com/feeds/api/users/ACCOUNT_CHANNEL_NAME/uploads/VIDEO_ID</id>

祝你好运!

这篇关于使用 YouTube API 和 HTTpWebRequest 批量删除视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆