Ajax YouTube 上传

发布于 2024-12-01 14:45:05 字数 1018 浏览 1 评论 0原文

我正在尝试实现可断点续传的视频上传到 Youtube, 如下所述:youtube 可续传上传 API
但我收到错误:“NetworkError: 404 Not Found - http: //uploads.gdata.youtube.com/resumable/feeds/api/users/default/uploads”。
这是代码:

    var http = new XMLHttpRequest(); 
    var url = "http://uploads.gdata.youtube.com/resumable/feeds/api/users/default/uploads";   
    http.open("POST", url, true);
    http.setRequestHeader("Host", "uploads.gdata.youtube.com");
    http.setRequestHeader("Authorization", "AuthSub token=\"yDXi4sfOb8RYWDIH....MEAxMzE0MzAzMDEy\"");
    http.setRequestHeader("GData-Version", 2);
    http.setRequestHeader("X-GData-Key", "key=DI39si4Tl....18OaRy");
    http.setRequestHeader("Content-length", 0);
    http.setRequestHeader("Slug", "test.avi");
    http.send(null);

我将不胜感激您的帮助。

I'm trying to implement resumable video upload to Youtube,
as described here: youtube resumable upload api .
But I am getting error: "NetworkError: 404 Not Found - http://uploads.gdata.youtube.com/resumable/feeds/api/users/default/uploads".
Here is code:

    var http = new XMLHttpRequest(); 
    var url = "http://uploads.gdata.youtube.com/resumable/feeds/api/users/default/uploads";   
    http.open("POST", url, true);
    http.setRequestHeader("Host", "uploads.gdata.youtube.com");
    http.setRequestHeader("Authorization", "AuthSub token=\"yDXi4sfOb8RYWDIH....MEAxMzE0MzAzMDEy\"");
    http.setRequestHeader("GData-Version", 2);
    http.setRequestHeader("X-GData-Key", "key=DI39si4Tl....18OaRy");
    http.setRequestHeader("Content-length", 0);
    http.setRequestHeader("Slug", "test.avi");
    http.send(null);

I would be grateful for the help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

兮子 2024-12-08 14:45:05

浏览器不支持可续传上传和直接上传功能 - 特别是它们违反了浏览器同源策略。您需要使用基于浏览器的上传或代理通过您的服务器上传。

The resumable upload and direct upload facilities are not supported from browsers -- in particular they violate browser same origin policies. You need to either use the browser based uploading or proxy the uploads through your server.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文