0

我有一个为客户创建和上传视频的应用程序。在尝试上传之前,客户授予授权并保存生成的访问和刷新令牌。有时,客户没有与其 Google 帐户关联的 YouTube 频道。我检测到这一点并为他们创建一个频道。这通常工作正常。但不总是。以下是创建通道失败的示例:

Obtaining access token for Customer
post https://accounts.google.com/o/oauth2/token
HTTP Response: 200
{
 "access_token" : "_new_access_token_",
 "token_type" : "Bearer",
 "expires_in" : 3600
}

Uploading video '_video_name_' for Customer
post http://uploads.gdata.youtube.com/feeds/api/users/default/uploads
    Authorization: Bearer _new_access_token_
    GData-Version: 2.1
    X-GData-Key: key=_GData_Key_
    Slug: n3n1xs.mp4
    Content-Type: multipart/related; boundary="51d366cb05b71"
    Content-Length: 255958407
    Connection: close
HTTP Response: 403
<?xml version='1.0' encoding='UTF-8'?><errors><error><domain>yt:service</domain><code>youtube_signup_required</code></error></errors>

Obtaining channel names for Customer
get https://gdata.youtube.com/feeds/api/suggest/username?hint=CustomerNameVT&fields=entry%2Ftitle
    GData-Version: 2.1
    X-GData-Key: key=_GData_Key_
HTTP Response: 200
<?xml version='1.0' encoding='UTF-8'?><feed xmlns='http://www.w3.org/2005/Atom'><entry><title>CustomerNameVT</title></entry><entry><title>VTCustomerName</title></entry><entry><title>VTNameCustomer</title></entry><entry><title>CustomerVTName</title></entry><entry><title>CustomerNameVT1</title></entry><entry><title>NameCustomerVT</title></entry><entry><title>NameVTCustomer</title></entry></feed>

Linking YT channel for Customer (CustomerNameVT)
put https://gdata.youtube.com/feeds/api/users/default
    Authorization: Bearer _new_access_token_
    Content-Type: application/atom+xml
    GData-Version: 2.1
    X-GData-Key: key=_GData_Key_
<entry xmlns='http://www.w3.org/2005/Atom' xmlns:yt='http://gdata.youtube.com/schemas/2007'><yt:username>CustomerNameVT</yt:username></entry>
HTTP Response: 403
<errors xmlns='http://schemas.google.com/g/2005'><error><domain>GData</domain><code>ServiceForbiddenException</code><internalReason>Forbidden</internalReason></error></errors>

请注意,请求的名称是建议用户名 api 建议的第一个名称。据我所见,这应该可行。它通常会。这次怎么了?

4

1 回答 1

0

用于将 Google 帐户链接到新频道的 API 已弃用

我们目前的建议是明确引导用户完成基于网络的链接过程,从https://youtube.com/create_channel(或 m.youtube.com 等效项)开始。

于 2013-07-09T16:33:19.093 回答