YouTube Developer APIs: New vs Old

December 1, 2008 Link to post  Permalink

Some time ago, I wrote an application that used the old YouTube API to extract information for specific videos. Recently, I wrote a similar application, and based on the warnings about the old API being deprecated, I used the new API.

The new YouTube API is based on some Google technologies, which is great for making it scale, but may not be the best thing for some applications. It certainly isn’t the best for my application.

How soon can I get video data?

I want users of my application to see a video on YouTube and then add that video to my app, and for the video to show up. This sounds reasonable, except the New API for YouTube can be 2, 3, 4+ hours behind the website. This delay is Ok for Google search, but for my application, not being able to get info about a video that the user can clearly see is available kills the experience.

The Old API reports a video if the user can see it on the site.

The Overview for the new API documentation does list out the expected latency for getting new data through the API.

How often does this data update?

My application uses the views of a video to calculate a ‘value’ for the video. If the API can’t keep up with the views the user sees on the web site, then my valuation system breaks down. The New API can be 2, 3, 4+ hours behind in reporting the views of a video.

The Old API provides reasonably recent data

Speed of getting data for videos

The New API seems to provide data at about half the rate of the Old API. I can get data for twice as many videos with the Old API in the same amount of time.

Batching up API calls?

The Old API can’t do this at all.

The New API allows your to ‘search’ using the unique ID of a video to get data! This is the winner!

Oh, except that the results seem to be kind of random. If I look for 20 videos at a time, supplying the unique ID for each, I may get 12 of them returned. If I reduce my search to 8 videos, I seem to get most of the videos available, but who knows.

Getting data for several videos at once seems to be fairly non-deterministic, and for my application ends up being worse than broken (it looks like it works, but it actually doesn’t)

Future access to the API?

YouTube has documented that the Old API is in danger after August 30, 2008. Currently it still works. Since the New API is essentially broken for my application, this will never be an option for me.

My fallback has to be screen scraping to get the data I need. I just need to monitor this to be prepared when they disable the Old API, and after that, whenever the UI changes enough to break my code.

Summary

Sometimes, newer isn’t always better. The Old YouTube API provides all I need for my app, where the New API just doesn’t.