How to filter by duration in Youtube search API

I am trying to filter the search results by duration (short) parameter. However, it still returns video up to 1 hour. In addition, the orderby parameter does not work. Here's the code (all other filters work):

var request = gapi.client.youtube.search.list({
  part: 'snippet',
  q: 'kittens',
  maxResults: 5,
  duration: 'short',
  orderby: 'published',
});

Is there anything related to the fact that these are “custom search parameters”? If so, how to use them?

Thanks in advance!

+4
source share
1 answer

The search API reference says that you need to specify "type" as a video.

If you specify a value for this parameter, you must also set the type to parameter value for the video.

(: https://developers.google.com/youtube/v3/docs/search/list)

"type".

+1

Source: https://habr.com/ru/post/1540429/


All Articles