Stream status check script no longer working


#1

I wrote this script which was working perfectly, but it suddenly stopped working. I wonder why. :frowning:

<script type="text/javascript">
    var user_name, myID, twitch_widget;

  user_name = "MyName";
  myID = "My Id";
  twitch_widget = jQuery(".streamstatus a");
jQuery(function(){
        twitch_widget.attr("href", "https://www.twitch.tv/" + user_name);
        twitch_widget.attr("target", "_blank");  
jQuery.getJSON("https://api.twitch.tv/kraken/streams/" + user_name + "?client_id=" + myID + "&callback=?", function(data) {
    if (data.stream) {
        twitch_widget.html("<div class='infostream'> <img src='" + data.stream.preview.medium + "' alt='" + user_name + " joue à " + data.stream.game + " sur Twitch (" + data.stream.viewers + " viewers)'/>" + data.stream.game + " (" + data.stream.viewers + " viewers)</div>On Air<span class='online'></span>"); 
        }
    else {
        twitch_widget.html("Off Air<span class='offline'></span>");
        }
    })});
</script>

#2

You’re using a v3 endpoint, which has been deprecated for a long time and well advertised as scheduled for removal, which happened last month.

You need to migrate to v5 https://dev.twitch.tv/docs/v5/guides/migration, or preferably to Helix as v5 itself is deprecated and at some point in the future will also be removed.


#3

Thank you. I’m gonna change that. :slightly_smiling_face: