2

I currently use something like https://www.googleapis.com/youtube/v3/search?part=id&order=date&channelId=CHANNELID&maxResults=1&type=video&key=KEY and I want to be able to retrieve only the latest video and to totally exclude shorts.

How can I achieve this?

Paul Berger
  • 49
  • 1
  • 6
  • You must proceed with the endpoint you mentioned and then locally filter shorts using [this method](https://stackoverflow.com/a/71194751) for instance. – Benjamin Loison Oct 29 '22 at 16:14

2 Answers2

0

The Youtube search method

Will allow you to search for things like keyword, location, events, your own videos and related videos.

There is no way to filter or limit videos returned. Your only hope would be to sort them out locally when you get the results.

You may want to add a feature request here there is this one but it's really old Search API: More flexible/logical videoDuration requests

Benjamin Loison
  • 3,782
  • 4
  • 16
  • 33
Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
-1

(sorry its my 1st time answering at stackoverflow, so might not be descriptive)

if you you use youtube serch method

then you'll realise that shorts description are assigned as empty string "" where as the videos have some description . so with an if condition like below can slove your problem (js)

if(!(video.snippet.description == ""))

  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 21 '22 at 22:26