Я пытаюсь получить список видео, прошедших проверку подлинности пользователя, которые были загружены в определенный диапазон дат, независимо от статуса (частный, незарегистрированный, общедоступный и т. Д.). Глядя на документацию API, выясняется, чтоСоответствующие конечные точки, которые принимают даты в качестве параметров запроса, являются конечными точками /search
и /activities
.
Однако при попытке использовать параметры publishedAfter
или publishedBefore
этих конечных точек ответы включают только общедоступные видео.,Я пробовал альтернативно установить параметры mine
и forMine
против channelId
канала аутентифицированного пользователя, но результат тот же.Кроме того, попытка использовать конечную точку /search
с publishedAfter
или publishedBefore
и forMine==true
возвращает ошибку 400, указывающую недопустимую комбинацию фильтров.
Есть ли способ отфильтровать ВСЕ видео пользователя по дате через API?Я просмотрел похожие вопросы, и общий ответ - использовать order
и maxResults
, чтобы выполнить фильтрацию в ответе.Я хотел бы избежать этого, если это вообще возможно, из-за того, что потенциальные пользователи моего приложения имеют довольно большое количество видео (~ 10000), что делает фильтрацию ответов крайне неэффективным методом.
Пример запросана /search
с использованием forMine==true
и датами:
https://www.googleapis.com/youtube/v3/search?access_token={token}&part=snippet&forMine=true&publishedAfter=2018-04-01T04:00:00.000Z&publishedBefore=2018-05-17T04:00:00.000Z&type=video
Ответ:
{
"error": {
"errors": [
{
"domain": "youtube.search",
"reason": "invalidSearchFilter",
"message": "The request contains an invalid combination of search filters and/or restrictions. Note that you must set the <code>type</code> parameter to <code>video</code> if you set either the <code>forContentOwner</code> or <code>forMine</code> parameters to <code>true</code>. You must also set the <code>type</code> parameter to <code>video</code> if you set a value for the <code>eventType</code>, <code>videoCaption</code>, <code>videoCategoryId</code>, <code>videoDefinition</code>, <code>videoDimension</code>, <code>videoDuration</code>, <code>videoEmbeddable</code>, <code>videoLicense</code>, <code>videoSyndicated</code>, or <code>videoType</code> parameters.",
"locationType": "parameter",
"location": ""
}
],
"code": 400,
"message": "The request contains an invalid combination of search filters and/or restrictions. Note that you must set the <code>type</code> parameter to <code>video</code> if you set either the <code>forContentOwner</code> or <code>forMine</code> parameters to <code>true</code>. You must also set the <code>type</code> parameter to <code>video</code> if you set a value for the <code>eventType</code>, <code>videoCaption</code>, <code>videoCategoryId</code>, <code>videoDefinition</code>, <code>videoDimension</code>, <code>videoDuration</code>, <code>videoEmbeddable</code>, <code>videoLicense</code>, <code>videoSyndicated</code>, or <code>videoType</code> parameters."
}
}
Этот же запрос без параметров publishedAfter
и publishedBefore
возвращает все видео пользователя, как ожидалось.