我对YouTube API V2有疑问。 我想将评论上传到Youtube,但是会发生以下错误: NoLinkedYouTubeAccount \ n
我在互联网上搜索过,但我找到的唯一原因是,该帐户不是YouTube帐户,但我也使用此帐户喜欢YouTube上的某些视频,...,所以这不应该是原因。她是我发布的代码:
{
string data = @"<?xml version=""1.0"" encoding=""UTF-8""?>
<entry xmlns=""http://www.w3.org/2005/Atom"" xmlns:yt=""http://gdata.youtube.com/schemas/2007"">
<content>" + comment + "</content></entry>";
HttpContent content = new StringContent(data);
content.Headers.ContentLength = data.Length;
content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/atom+xml");
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + authToekn);
client.DefaultRequestHeaders.Add("X-GData-Key", "key=" + developer_key);
HttpResponseMessage message = await client.PostAsync(url, content);
MemoryStream stream = new MemoryStream();
string result = await message.Content.ReadAsStringAsync();
}
登录通过OAuth2.0运行,我获得了身份验证令牌和刷新令牌。有谁知道问题(或我的错)是什么?