Data, Maps, Usability, and Performance

Advanced YouTube Search with Video Feeds API

Last updated on August 2, 2012 in Development

YouTube API Video Feeds

I have been using the YouTube API Video Feeds for a while and it amazes me how it allows you to search and filter your query way beyond what the YouTube website allows. For example, how do you search for most discussed videos from the comedy category on YouTube? How about, most popular comedy videos from Brazil? I love the YouTube UI but I really think that they need an advanced search function that will allow you to create any kind of query that you can easily create with their API or feeds service. The best part is that you don’t even need an API key to do this because YouTube does not require one for these calls. Let’s take a closer look.

Videos on YouTube are currently split into 18 main categories:

So, out of the 18 main categories, 15 work with feeds. Videos can be retrieved in 9 different ways:

The top rated, top favorites, most discussed, most popular and most responded standard feeds support the time parameter which is all_time by default but can be changed to today, this week, or this month. You can filter the results by different regions of the world:

Most of this information, if not more, is already provided in the Google documentation but I learned that some info is outdated (available regions, time parameter, etc). This link has detailed information on available API query parameters and it’s great because I can further filter things by HD only videos, 3D only videos, duration of video, safe search settings, and even just normal search results that are not connected to types of feeds. It really gives you a way to perform an advanced search on YouTube.

I have provided a bunch of selects, checkboxes, and input fields that let you query the right parameters and I am showing the API call url, as well as the original response of the API call (using JSON.stringify()). I build this demo pretty quickly so it needs some design love but the JavaScript code is pretty straightforward. Check it out and let me know how I can make it better. Apart from design and some code cleanup, I could add pagination, location options, more user-based features, and detailed video information.

If you are interested in learning more ways to leverage the YouTube API, I recommend looking at YouTube on APIgee.

Tags: ,

Facebook Twitter Hacker News Reddit More...