Created
February 25, 2013 19:45
-
-
Save alexdelany/5032602 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var vids = _.keys(this.queue) | |
for (i = 0;i<vids.length;i+= 50){ | |
options = { | |
host: 'www.googleapis.com', | |
path: "/youtube/v3/videos?id=" | |
+ vids.slice(i,i+50).join(",") | |
+ "&part=statistics&fields=items&key=" | |
+ "AIzaSyBzaqm6tPr9knyq7uNYrEjIouMUvCave10" // api key | |
} | |
var queryResponse = '' | |
https.get(options, function(response) { | |
console.log("Got response: " + response.statusCode + "\2" + " : i = " + i) | |
response.on('data', function(chunk){ | |
queryResponse += chunk | |
}) | |
response.on('end', function(){ | |
var results = JSON.parse(queryResponse) | |
console.log("\n"+results.items.length+" RESULTS PARSED FROM YOUTUBE\n") | |
}) | |
}) | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
var makerequest = function(options) {
https.get......
}