Пример #1
0
boardmanager.validateYT = function(id,cb){

	yt.videos.list({
	    "id": id,
	    "maxResults": 1,
	    "part" : "id,snippet"
	}, function (err, data) {

		var r = {
			status : ['NOT_FOUND'],
			data : {}
		};

		if(data){
			if(data.pageInfo.totalResults>=1){
				r.status = true;
			}
			r.data=data;
		}else{
			r.data=err;
		}

	    cb(r);
	});
}
Пример #2
0
yt.standard = function(page,country,cb){
    videos_responses = new Array();
    var params = {
        regionCode:''+country+'',
        maxResults: 25,
        hl: ''+country+'',
        part: 'snippet',
        chart: 'mostPopular'
    }

    if(page !== 1) {
        params.pageToken = page;
    }

    try{
        ytapi.videos.list(params,
            function( err, data ) {
                console.log(err,data)
            if( err ) {
                cb(err);
            } else {
                console.log(data)
                current_start_index = cb.nextPageToken;
                cb(data);
            }
        });
    }catch(err){
        console.log('searchVideos err: '+err);
    }
}
Пример #3
0
	parseYoutube: function (videoID , irchChannel ) {
		youtube.videos.list({
			"part":"id,snippet,statistics",
			"id":videoID
		}, function( err, data ){
			if( err != null )
			{
				c.say( irchChannel, irc.colors.wrap('red', 'Something went wrong. PBX_g33k!! Fix me you lazy ass developer. ERR:YT02 ('+videoID+')' ));
			} else {
				var items = data.items[0];
				//for (var i = items.length - 1; i >= 0; i--) {
					var snippet = items.snippet;
					var statistics = items.statistics;
					// Example line: youTube: [TITLE] 【IA】Liberator - taishi【Original MMD-PV】 [UPLOADER] Vanguard Sound Studio [VIEWS] 5030 [LIKES] 273 [COMMENTS] 20
					var line =
						'\u00031,0You\u00030,4Tube\u000f: \u0002\u000310[TITLE]\u000f ' +
						snippet.title +
						' \u0002\u000310[UPLOADER]\u000f ' +
						snippet.channelTitle +
						' \u0002\u000310[VIEWS]\u000f ' +
						statistics.viewCount +
						' \u0002\u000310[LIKES]\u000f ' +
						statistics.likeCount +
						' \u0002\u000310[COMMENTS]\u000f ' +
						statistics.commentCount;
					c.say( irchChannel, line );
				//};
			}
		});
	},