<head>
<!-- Pulling jQuery from Google's servers, since most people already have it cached, the page loads faster -->
<script
type=
"text/javascript"
>
document
.
write
(
"\<script src='//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js' type='text/javascript'>\<\/script>"
);
</script>
<!-- Pulling the Twitch JS SDK from amazon because I'm lazy. You should get the newest one from github and host it yourself -->
<script
type=
"text/javascript"
src=
"https://ttv-api.s3.amazonaws.com/twitch.min.js"
></script>
<script
type=
"text/javascript"
>
$
(
document
).
ready
(
function
(){
// Now we initialize the SDK so we can actually use it
Twitch
.
init
({
clientId
:
'Your clientID Here'
/* Replace this with your application's clientID from http://www.twitch.tv/settings?section=applications */
},
function
(
error
,
status
){
});
// This is the list of streams you want to check the live status of
var
list
=
[
'fire'
,
'siglemic'
,
'destructoid'
,
'fpcforums'
,
'towelliee'
,
'oatavio'
,
'draco'
]
// Now we loop through the list of channels and check their statuses
$
.
each
(
list
,
function
(
index
,
channel
){
Twitch
.
api
({
method
:
'streams/'
+
channel
},
function
(
error
,
live
)
{
if
(
live
.
stream
==
null
){
// Stream is not live
console
.
log
(
channel
+
' is not live'
);
}
else
{
// Stream is live, live.stream.preview will be a stream preview image. Put it in a 16:9 container.
console
.
log
(
channel
+
' is live, preview image: '
+
live
.
stream
.
preview
);
}
});
});
});
</script>
</head>