Yozer
Yozer

Reputation: 648

YouTube API v3 search - don't return all videos

I'm using YouTube API v3 and here is my problem:

For example this video: https://www.youtube.com/watch?v=MHKMfkiq1OA

https://www.googleapis.com/youtube/v3/videos?part=snippet&key=My_Keys&id=MHKMfkiq1OA

was published at 2013-04-02T11:40:24.000Z

By when i try search for this movie using search engine like this:

https://www.googleapis.com/youtube/v3/search?part=snippet&order=date&key=MY_KEY&publishedAfter=2013-04-02T11:40:20.000Z&publishedBefore=2013-04-02T11:40:30.000Z

There is no result for this search, why?

Upvotes: 1

Views: 2492

Answers (1)

jlmcdonald
jlmcdonald

Reputation: 13667

Basically, "publishedBefore" and "publishedAfter" aren't really search parameters, but are more like filters that are applied to search results. If your API call only includes those two parameters, then there is nothing to base a search on. Notice that with this call:

https://www.googleapis.com/youtube/v3/search?part=snippet&order=date&q=movies&key=MY_KEY&publishedBefore=2013-04-02T11:40:24.300Z&publishedAfter=2013-04-02T11:40:20.000Z

The single video is returned. In essence, omitting the 'q' parameter is like telling YouTube to search for an empty string.

Upvotes: 1

Related Questions