YouTube API - Querying by publish date

tsilb picture tsilb · Apr 24, 2011 · Viewed 8k times · Source

I'm writing a webapp that uses the YouTube Code API to do specific types of searches. In this case, I'm trying to search for all videos that match a query, and which were uploaded between two dates. This document says I can use published-min and published-max parameters, while this one says I can use updated-min and updated-max.

Both of these parameter sets cause YouTube to return an error:

  • published-min returns "This service does not support the 'published-min parameter"
  • updated-min returns "This service does not support the 'updated-max' parameter"
  • With neither returns a correct result set.

How can I limit my result set to hits within a specified date range?

Answer

Grzegorz Oledzki picture Grzegorz Oledzki · May 2, 2011

The Reference Guide for YouTube's Data API doesn't list anything that would suggest the possibility to filter on time interval in general.

The published-min argument is only advertised in the "User activity feeds" section which is something different and probably not the thing you wanted. Or is it?

The updated-min argument in your link is referenced in a generic gdata context. It looks like they intended to describe all the things common to all the specialized APIs, but somehow updated-min isn't available everywhere.

When it comes to your very problem. I would suggest sorting on time (orderby=published) and do the filtering on the client side. I know this is not the optimal way, but the only one I can see with what Google gives us.