How do i get my stream title to display on my website

550 views
Skip to first unread message

Ashley Watson

unread,
Feb 21, 2014, 1:32:47 PM2/21/14
to twitc...@googlegroups.com
Hello,

I have spent ages trying to get my stream title to display on my website using the twitch api but i am failing.
Could someone help me with getting my stream title to display on my website.

Thanks,
Ashley

Teak Topham

unread,
Feb 23, 2014, 8:51:33 PM2/23/14
to twitc...@googlegroups.com
I think the following code may be of help. It does require jQuery.

<html>
    <head>
        <title>title</title>
        <link rel="stylesheet" href="css/reset.css" />
        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
        <script>
            var channel_name = 'your_twitch_name_here';
            $.ajax({
                url: 'https://api.twitch.tv/kraken/channels/' + channel_name,
                type: 'GET',
                dataType: 'jsonp',
                contentType: 'application/json',
                mimeType: 'application/vnd.twitchtv.v2+json',
                success: function(json_result) {
                    $('#my_stream_title').text(json_result.status);
                }
            });
        </script>
    </head>
    <body>
        <span id="my_stream_title">this gets replaced with your title</span>
    </body>
</html>
Reply all
Reply to author
Forward
0 new messages