Post comment to YouTube video using JavaScript

So I went to the YouTube API documentation (documentation link) and got the following:


    POST /feeds/api/videos/VIDEO_ID/comments HTTP/1.1
    Host: gdata.youtube.com
    Content-Type: application/atom+xml
    Content-Length: CONTENT_LENGTH
    Authorization: AuthSub token="AUTHORIZATION_TOKEN"
    GData-Version: 2
    X-GData-Key: key=DEVELOPER_KEY

And then some sample XML file.

Now my question is how do I actually do this? I have the developer key, token, etc. I just need to know how to put everything together and send. Please help.

TIA, S


You should ask user to select some file from his computer at first and then just call ajax() with data from your form. If you need custom headers you can do it - http://api.jquery.com/jQuery.ajax/

You should use ajax because I don't know if you can control request headers while general form submit event when page reloads.

链接地址: http://www.djcxy.com/p/48868.html

上一篇: Api评论视频

下一篇: 使用JavaScript发布对YouTube视频的评论