1var YOUTUBE = function(channelId, results){ 2 this.channelId = channelId; 3 this.results = results; 4 5 this.apiKey = 'AIzaSyDocKa2Bsqk7_RQ0Kdp51zZJqk974dcGKQ'; 6 this.urlBase = 'https://www.googleapis.com/youtube/v3/'; 7 8 this.datas = []; 9} 10 11YOUTUBE.prototype.getData = function(callback, q){ 12 var $this = this; 13 var data = { 14 key: this.apiKey, 15 channelId: this.channelId, 16 part: 'id, snippet', 17 fields: 'items(id,snippet(title,thumbnails(high)))', 18 order: 'date', 19 maxResults: this.results 20 }; 21 if(q){ 22 data.q = q; 23 } 24 25 $.ajax({ 26 url: this.urlBase+'search', 27 data: data, 28 dataType: 'jsonp' 29 }).done(function(json){ 30 for(var i in json.items){ 31 if(json.items[i].id.kind.indexOf('#video') != -1){ 32 $this.datas[$this.datas.length] = { 33 id: json.items[i].id.videoId, 34 title: json.items[i].snippet.title, 35 thumbnail: json.items[i].snippet.thumbnails.high.url 36 }; 37 } 38 } 39 40 callback($this.datas); 41 }); 42};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.