function loadYouTube(){
var doc = new XMLHttpRequest();
doc.onreadystatechange = function() {
if (doc.readyState == XMLHttpRequest.DONE) {
var jsresp = JSON.parse(doc.responseText);
var entries = jsresp.feed.entry;
var len = entries.length
rssModel.clear();
var vi=1;
for (var i = 0; i < len; i++) {
var obj = entries[i];
rssModel.append( {
number:
i + 1,
url:
(function() {
try {
return(obj.id.$t.replace("http://gdata.youtube.com/feeds/api/videos/", ""));
}
catch(e) { return("(no title)"); }})(),
videoRTSP:
(function() {
try {
return(obj.media$group.media$content[1].url);
}
catch(e) { return("(no title)"); }})(),
videoHTTP:
(function() {
try {
return(obj.media$group.media$content[0].url);
}
catch(e) { return("(no title)"); }})(),
tags:
(function() {
try {
return(obj.yt$statistics.viewCount);
}
catch(e) { return("(no title)"); }})(),
photoType:
(function() {
try {
return(obj.category[0].term);
}
catch(e) { return("(no title)"); }})(),
description:
(function() {
try {
return(obj.content.$t);
}
catch(e) { return("(no title)"); }})(),
photoAuthor:
(function() {
try {
return(trimString(obj.author[0].name.$t,35));
}
catch(e) { return("(no title)"); }})(),
photoHeight:
(function() {
try {
return(obj.media$group.media$thumbnail[0].height);
}
catch(e) { return("(no title)"); }})(),
photoWidth:
(function() {
try {
return(obj.media$group.media$thumbnail[0].width);
}
catch(e) { return("(no title)"); }})(),
photoDate:
(function() {
try {
return(obj.published.$t);
}
catch(e) { return("(no title)"); }})(),
imagePath:
(function() {
try {
return(obj.media$group.media$thumbnail[0].url);
}
catch(e) { return("(no title)"); }})(),
title:
(function() {
try {
return(trimString(obj.title.$t,35));
}
catch(e) { return("(no title)"); }})()
});
}
console.log("Successfully")
}
}
doc.open("GET", "http://gdata.youtube.com/feeds/api/videos?q="+rssModel.tags+"&orderby=viewCount&alt=json&max-results=32");
doc.send();
}