gpt4 book ai didi

Javascript Youtube 数据 API v3 : Inserting video in a playlist (Video not found)

转载 作者:行者123 更新时间:2023-12-03 06:11:44 29 4
gpt4 key购买 nike

当我提交表单时,我正在尝试将视频添加到我在 youtube 上的私有(private)播放列表中。
我请求所选视频的 id,它也在我的控制台中正确打印。
但是当我尝试将视频添加到播放列表时,我收到 404 错误:找不到视频。但是,如果打开错误,我会收到以下消息...

{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "dailyLimitExceededUnreg",
"message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.",
"extendedHelp": "https://code.google.com/apis/console"
}
],
"code": 403,
"message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup."
}
}

这是我将视频添加到播放列表的代码。
        $('#form1').on('submit', function(e) {
e.preventDefault();
var id = $("#idArticle").val();

var request = gapi.client.youtube.playlistItems.insert({
part: 'snippet',
resource: {
snippet: {
playlistId: 'PLcQyg31odPUkASkMF09QBGqD8qKOQoe-l',
resourceId: {
videoId: id,
kind: "youtube#video",
}
}
}
});
request.execute(function(response) {
console.log(response);
$('#videoDetails').html('<p>' + response + '</p>');
});
console.log("Added.?");
});

最佳答案

基于此thread ,如果您没有使用 Oauth2 对应用程序进行身份验证,或者您没有随此请求发送 API key ,则可能会出现此问题。

  1. You need a Google Account to access the Google Developers Console, request an API key, and register your application.
  2. Create a project in the Google Developers Console and obtain authorization credentials so your application can submit API requests.
  3. After creating your project, make sure the YouTube Data API is one of the services that your application is registered to use:
    a. Go to the Developers Console and select the project that you just registered. b. Open the API Library in the Google Developers Console. If prompted, select a project or create a new one. In the list of APIs, make sure the status is ON for the YouTube Data API v3.
  4. If your application will use any API methods that require user authorization, read the authentication guide to learn how to implement OAuth 2.0 authorization.

see Getting started

关于Javascript Youtube 数据 API v3 : Inserting video in a playlist (Video not found),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51935417/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com