FugiTech / Twitch-Channel-Status

A library that makes it easy to display whether a Twitch channel is online or not
MIT License
32 stars 14 forks source link

Script dont working with actual API #2

Open fabki opened 7 years ago

fabki commented 7 years ago

Is there a possibility to change the script to work with the actual API?

https://blog.twitch.tv/client-id-required-for-kraken-api-calls-afbb8e95f843#.mb57f5w8c

So simply adding " headers: {"Client-ID": "yourclientidhere"}, " to the request don't work.

// Ask twitch for the status of all channels at once $.ajax({ headers: {"Client-ID": "yourclientidhere"}, url: "https://api.twitch.tv/kraken/streams", data: {"channel": Object.keys(channels).join(","), "limit": Object.keys(channels).length}, cache: false, dataType: "jsonp" }).done(function (data) { // We can only handle 100 online channels at a time :( if (data.streams.length < data._total) { console.warn("refreshTwitchChannelStatuses couldn't load all online channels! Please reduce the number of channels you are trying to check."); }

blizam commented 7 years ago

aye, this script recently stopped working...

robbiemu commented 7 years ago

Twitch made all calls to the API under 'kraken' path require 'client id'; For details, check out https://blog.twitch.tv/client-id-required-for-kraken-api-calls-afbb8e95f843#.1nqjlhs8h

to fix this library, it probably needs to be modified to accept a new <script> attribute, like data-clientid, and the single ajax like has to have the data payload include the clientid. it would not work right out of the box, but it could also include a console.log message if there is garbage/missing clientid

chuckreynolds commented 7 years ago

bump

calexil commented 4 years ago

bump, any clean way to do this in a single .js found yet?

also for reference: https://discuss.dev.twitch.tv/t/announce-when-my-channel-is-live-on-my-website-in-an-html-element-using-js/22648