The Stanford dude Feross Aboukhadijeh unleashed a viral phenomenon with youtube instant mashup. 1 million users visited the site in 10 days. According to Feross, it took only 3 hours to put it together. He also secured a job in Google from none other than the top guy of youtube. Sounds crazy?
I was a little curious to know the technology behind this craziness but google search didn't help. I am sure it is there somewhere, but for the moment google seems to be stuck in the story itself. Instead of wasting time searching, I decided to lift the hood myself - to find that this shiny gadget is implemented in three simple steps.
Once the user enters a set of characters, the first step is finding suggested keywords. Luckily, there is a google API for that. Let us say the user enters 'a'. All the suggested keywords for 'a' can be found by invoking this API.
http://suggestqueries.google.com/complete/search?hl=en&ds=yt&client=youtube&hjson=t&jsonp=resp&q=a&cp=1
This returns the top search keywords like "airplane" , "alejandro lady gaga", "airplanes b.o.b" etc.
Now pick the first keyword, which is "airplane", and make another youtube API call.
http://gdata.youtube.com/feeds/api/videos?q=airplane&format=5&max-results=10&v=2&alt=jsonc
This will give you vital statistics about all relevant videos in JSON format.
Finally, display the first video from the above list: http://www.youtube.com/v/kn6-c223DUU
Hats off to Ferosse for his ingenuity! This is also a window to the possibilities of cloud computing. Buckle up!
I was a little curious to know the technology behind this craziness but google search didn't help. I am sure it is there somewhere, but for the moment google seems to be stuck in the story itself. Instead of wasting time searching, I decided to lift the hood myself - to find that this shiny gadget is implemented in three simple steps.
Once the user enters a set of characters, the first step is finding suggested keywords. Luckily, there is a google API for that. Let us say the user enters 'a'. All the suggested keywords for 'a' can be found by invoking this API.
http://suggestqueries.google.com/complete/search?hl=en&ds=yt&client=youtube&hjson=t&jsonp=resp&q=a&cp=1
This returns the top search keywords like "airplane" , "alejandro lady gaga", "airplanes b.o.b" etc.
Now pick the first keyword, which is "airplane", and make another youtube API call.
http://gdata.youtube.com/feeds/api/videos?q=airplane&format=5&max-results=10&v=2&alt=jsonc
This will give you vital statistics about all relevant videos in JSON format.
Finally, display the first video from the above list: http://www.youtube.com/v/kn6-c223DUU
Hats off to Ferosse for his ingenuity! This is also a window to the possibilities of cloud computing. Buckle up!
Nice writeup, Kamal. I was wondering about this, too.
ReplyDeleteBrian