我尝试为自己制作一个小型应用程序,但我发现了这个应用程序如何使用C#在Dailymotion上上传视频?有人有完整的代码吗?
I try to make small application for myself and I found this application How to upload video on Dailymotion with c# ?? Is somebody has a complete code?
当我尝试所有操作但发布不起作用时.我使用了提琴手,但我找不到错误.这是代码
When I tried every thing but publishing is not working. I used fiddler but I cant find the error. Here is the code
var request = WebRequest.Create("api.dailymotion/me/videos?url=" + Uri.EscapeUriString(uploadResponse.url)); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; request.Headers.Add("Authorization", "OAuth " + accessToken); var requestBytes = Encoding.UTF8.GetBytes("title=test 123&channel=Funny&tags=Humor&description=Testing testing&published=true"); var requestBytes = Encoding.UTF8.GetBytes(requestString); var requestStream = request.GetRequestStream(); requestStream.Write(requestBytes, 0, requestBytes.Length); var response = request.GetResponse(); var responseStream = response.GetResponseStream(); string responseString; using (var reader = new StreamReader(responseStream)) { responseString = reader.ReadToEnd(); }当到达request.GetResponse()时,将给出错误.那么,这里出了什么问题??
When it reaches request.GetResponse() it gives the error. So what is the problem here..?
推荐答案我相信您在使用OAuth而不是基本身份验证时需要摆脱url中的我",
I believe you need to get rid of the "me" in the url as you're using OAuth instead of basic authentication, like this:
"api.dailymotion/videos?url="代替:
"api.dailymotion/me/videos?url="至少在一个看起来像这样的快速扫描中,一年前,我为一个客户端编写了一个自动发布器,它没有在URL中使用 me .我的凭据现在无效,因此无法对其进行测试.您链接的答案中似乎有一个错误.
At least in a quick scan that looks like it's it, I wrote an auto-publisher for a client a year ago and it didn't use the me in the url. My credentials are invalid now, so can't test it unfortunately. It seems to be a bug in the answer you linked.
如果您能阅读其他语言,我发现遍历他们的SDK并转换代码会很有帮助:
If you can read other languages, I found it helpful just going through their SDKs and converting the code:
www.dailymotion/doc/api/sdk-php.html
github/dailymotion/dailymotion-sdk-php/blob/master/Dailymotion.php
更多推荐
远程服务器返回错误:(403)禁止.在发帖期间...?
发布评论