i'm trying to get unlisted videos from a user authenticated by api key
i receive the error
"error": {
"errors": [
{
"domain": "youtube.search",
"reason": "invalidSearchFilter",
"message": "The request contains an invalid combination of search Note that you must set the \u003ccode\u003etype\u003c/code\u003e parameter to \u003ccode\u003evideo\u003c/code\u003e if you set a value for the \u003ccode\u003eeventType\u003c/code\u003e, \u003ccode\u003evideoCaption\u003c/code\u003e, \u003ccode\u003evideoCategoryId\u003c/code\u003e, \u003ccode\u003evideoDefinition\u003c/code\u003e, \u003ccode\u003evideoDimension\u003c/code\u003e, \u003ccode\u003evideoDuration\u003c/code\u003e, \u003ccode\u003evideoEmbeddable\u003c/code\u003e, \u003ccode\u003evideoLicense\u003c/code\u003e, \u003ccode\u003evideoSyndicated\u003c/code\u003e, or \u003ccode\u003evideoType\u003c/code\u003e parameters.",
as you can see my get request contains a type=video parameter.
When i try https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.search.list?part=snippet&forMine=true&maxResults=50&type=video
with logged in the youtube account using oauth2 it works fine
答案 0 :(得分:0)
您无法为forMine
参数使用API密钥。
您需要发送授权的OAuth2请求才能使用。
$ curl --header "Authorization: Bearer <YOUR_ACCESS_TOKEN>" https://www.googleapis.com/youtube/v3/search?part=snippet&type=video&forMine=true&maxResults=50
{
"kind": "youtube#searchListResponse",
"etag": ...
https://developers.google.com/youtube/v3/docs/search/list#forMine