Heard of the story http://ytinstant.com/
So I saw the code, the primary code is in http://ytinstant.com/instant6.js
Firstly, search the suggestion words array from google:
var the_url = 'http://suggestqueries.google.com/complete/search?hl=en&ds=yt&client=youtube&hjson=t&jsonp=window.yt.www.suggest.handleResponse&q='+encodeURIComponent(searchBox.val())+'&cp=1';
$.ajax({
type:
"GET",
url: the_url,
dataType:
"script"
});
Secondly, load video from youtube videos api:
$.ajax({
type: "GET",
url: the_url,
dataType:
"jsonp",
success:
function(responseData, textStatus, XMLHttpRequest) {
if (responseData.data.items) {
updateVideoDisplay(responseData.data.items);
}
else {
updateSuggestedKeyword(
'No results for "'+keyword+'"');
}
doneWorking();
}
});
others is something typing call real time states changing.