YouTube API v2 Classic ASP 無法刪除視頻



我正在尝试使用 YouTube API v2 删除视频。我已经能够上传视频,所以我相信我正在正确构建请求,但在删除上传的视频时遇到问题。当我发送请求时,出现以下错误:

400: Bad Request
GDataParseException
Premature end of file.

这是我通过 API 发送的内容:

Call objXMLHttp.open("PUT", "https://gdata.youtube.com/feeds/api/users/" & strYTUser & "/uploads/" & strVideoID, False)
Call objXMLHttp.setRequestHeader("DELETE", "/feeds/api/users/" & strYTUser & "/uploads/" & strVideoID & " HTTP/1.1")
Call objXMLHttp.setRequestHeader("Host", "gdata.youtube.com")
Call objXMLHttp.setRequestHeader("Authorization", "Bearer " & strAccessToken)
Call objXMLHttp.setRequestHeader("GData-Version", 2)
Call objXMLHttp.setRequestHeader("X-GData-Key", "key=" & strDevKey)
' Call objXMLHttp.setRequestHeader("Content-Length", 0)
Call objXMLHttp.setRequestHeader("Content-Type", "application/atom+xml; charset=UTF-8")
Call objXMLHttp.Send("")

正在使用文档作为参考,我尝试搜索但找不到有用的东西,所以我不知道我错过了什么。

https://developers.google.com/youtube/2.0/developers_guide_protocol_updating_and_deleting_videos#Deleting_a_video

任何提示/线索/等,将不胜感激!提前感谢!

根据给定的例子:

DELETE /feeds/api/users/default/uploads/VIDEO_ID HTTP/1.1
Host: gdata.youtube.com
Content-Type: application/atom+xml
Authorization: Bearer ACCESS_TOKEN
GData-Version: 2
X-GData-Key: key=DEVELOPER_KEY

请求调用应如下所示:

objXMLHttp.open "DELETE", "https://gdata.youtube.com/feeds/api/users/" & strYTUser & "/uploads/" & strVideoID, False
objXMLHttp.setRequestHeader "Host", "gdata.youtube.com"
objXMLHttp.setRequestHeader "Content-Type", "application/atom+xml"
objXMLHttp.setRequestHeader "Authorization", "Bearer " & strAccessToken
objXMLHttp.setRequestHeader "GData-Version", 2
objXMLHttp.setRequestHeader "X-GData-Key", "key=" & strDevKey
objXMLHttp.Send

相关内容

  • 没有找到相关文章

最新更新