npm install twitch.tv
var twitch = require("twitch.tv")
twitch("streams", function(err, res) {
console.log(res)
})
Default options:
{
ua: "node.js twitch.tv by mediremi",
apiVersion: "2",
clientID: ""
}
options.baseUrl
->Twitch.tv
API base URLoptions.ua
-> User agent sent toTwitch.tv
options.apiVersion
-> API version usedoptions.clientID
-> Client ID provided byTwitch.tv
. Used for rate-limiting
callback
is called with two parameters: err
and response
.
Examples:
twitch("channel", function(err, res) {
console.log(res)
})
twitch("games/top", function(err, res) {
if (err) return console.error(err)
console.log(res.top)
})
twitch("videos/top", {
ua: "get-cool-twitch-vids.com",
apiVersion: 1,
clientID: "axjhfp777tflhy0yjb5sftsil"
})