将视频上传到YouTube,请求执行失败,(401)未经授权 [英] Upload video to YouTube, Execution of request failed, (401) Unauthorized
问题描述
我正在尝试将不公开的视频上传到我的youtube帐户,但我仍然遇到无法解决的错误.据我所知,YouTube Data Api 3目前不支持任何.Net,在为期两天的搜索答案中,我看到最成功的人使用了Google GData.
I am trying to upload unlisted videos to my youtube account, i continue to get errors which i can't resolve. The YouTube Data Api 3 is does not support any .Net currently as far as i can see, and during my two day search for answers i see people with the most success have used the Google GData.
以下是我在GData上尝试发布YouTube视频的尝试.
Below is my attempt at GData trying to post a YouTube video.
Imports Microsoft.VisualBasic
Imports System
Imports System.IO
Imports System.Reflection
Imports System.Threading
Imports System.Threading.Tasks
Imports Google.GData.Client
Imports Google.GData.Extensions
Imports Google.GData.YouTube
Imports Google.GData.Extensions.MediaRss
Imports Google.YouTube
Sub DirectUpload()
Dim APIkey As String = "MyKey"
Dim Path As String = "c://Users/Shaun/Desktop/TestVid/test.mp4"
Dim Title = "My Test Movie1"
Dim settings As New YouTubeRequestSettings("Uploader", APIkey)
settings.Timeout = 60 * 60 * 1000
Dim request As New YouTubeRequest(settings)
Dim service As New YouTubeService("Uploader", APIkey)
DirectCast(request.Service.RequestFactory, GDataRequestFactory).Timeout = 9999999
DirectCast(service.RequestFactory, GDataRequestFactory).KeepAlive = False
Dim newVideo As New Video()
newVideo.Title = Title
newVideo.Tags.Add(new MediaCategory("People & Blogs", YouTubeNameTable.CategorySchema))
newVideo.Keywords = "Halls"
newVideo.Description = "Halls-" + Title
newVideo.YouTubeEntry.Private = true
'newVideo.Tags.Add(new MediaCategory("mydevtag, anotherdevtag", YouTubeNameTable.DeveloperTagSchema))
newVideo.YouTubeEntry.MediaSource = new MediaFileSource(Path,"video/quicktime")
dim createdVideo As Video = request.Upload(newVideo)
'Success
End Sub
我收到以下错误消息:
执行请求失败: https://uploads.gdata.youtube.com/feeds/api/用户/默认/上传
Execution of request failed: https://uploads.gdata.youtube.com/feeds/api/users/default/uploads
远程服务器返回错误:(401)未经授权.
The remote server returned an error: (401) Unauthorized.
我认为这是未经许可的用户许可. 我已经创建了一个产品并使用了开发人员密钥吗?
I assume this has to be user permitions as its Unauthorized. I have created a product and user the Developer Key provided so?:
推荐答案
每个Google帐户都被阻止访问未知应用程序.
也许您收到了来自Google安全团队的有关未知活动的电子邮件.
需要登录并通过Google帐户安全设置( https://www.google.com/settings/u/1/security/lesssecureapps )
Every Google Account is blocked for unknown applications access.
Maybe you have got the e-mail from Google security team about unknown activity.
Need to log in and grant access for unknown applications at Google account security settings (https://www.google.com/settings/u/1/security/lesssecureapps)
这篇关于将视频上传到YouTube,请求执行失败,(401)未经授权的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!