解析Youtube播放列表(Jquery mobile)

时间:2013-07-02 23:27:12

标签: javascript jquery youtube

我试图在我的jquerymobile / phonegap应用中解析这个Youtube播放列表。但它没有返回任何结果。我做错了什么。 我的代码在

之下
     var URL="http://gdata.youtube.com/feeds/api/playlists/PLF-N2d3bs_9gVydP2YiG61ePBANMHXFKH?v=2&alt=jsonc&callback=?&max-results=15&start-index=15";
      $.ajax({
        type: "GET",
        url: URL,
        cache: false,
        dataType:'jsonp',
        success: function(data){
           $.each(data.data.items, function(index) { 
           var myDateArray = this.updated.split("-");
           var date = 1+parseInt(myDateArray[1])+"/"+(myDateArray[2]).toString().substr(0,2)+"/"+myDateArray[0];
           var thumb = this.thumbnail.sqDefault;
           var count = this.viewCount; 
           idiam = this.id; 
           var me = this.uploader;
           var time = this.duration; 
           var title = this.title;
           var link = getAttributeByIndex(this.player, 0); 
           $('.real').append("<li   data-icon='false'><a><img src='" + thumb + "' />                  <h4>"+title+"</h4><p>" + count + " views | " + me + "</p></a></li>").listview('refresh');  
    });       
   }
   });

   // Used to get an element from an object
     function getAttributeByIndex(obj, index){
        var i = 0;
         for (var attr in obj){
       if (index === i){
        return obj[attr];
        }
     i++;
      }
       return null;
     }

0 个答案:

没有答案