Kraken API stopped working when fetching streams

I’m using a script to fetch the top viewed streamer for a certain game, but last night it just stopped working. I get 400 bad request. I haven’t changed the script in 12 days but now it just won’t work.

The request I’m attempting:
game = urllib.parse.quote_plus(“The Elder Scrolls: Legends”)
data = request(“https://api.twitch.tv/kraken/streams/?game=” + game + “&limit=1&stream_type=live”)

Did something change?

{ error: ‘Bad Request’,
status: 400,
message: ‘No client id specified’ }

my ploblem is looks like same. server send that message?

Client-IDs are required on all requests, and I don’t see one up there. Works fine for me with a Client ID

curl -H 'Accept: application/vnd.twitchtv.v5+json' -H 'Client-ID: mine' -X GET https://api.twitch.tv/kraken/streams?game=The+Elder+Scrolls:+Legends\&limit=1\&stream_type=live

{"_total":29,"streams":[{"_id":26460949952,"game":"The Elder Scrolls: Legends","broadcast_platform":"live","community_id":"","community_ids":[],"viewers":1002,"video_height":720,"average_fps":60,"delay":0,"created_at":"2017-10-11T17:13:23Z","is_playlist":false,"stream_type":"live","preview":{"small":"https://static-cdn.jtvnw.net/previews-ttv/live_user_justalazygamer-80x45.jpg","medium":"https://static-cdn.jtvnw.net/previews-ttv/live_user_justalazygamer-320x180.jpg","large":"https://static-cdn.jtvnw.net/previews-ttv/live_user_justalazygamer-640x360.jpg","template":"https://static-cdn.jtvnw.net/previews-ttv/live_user_justalazygamer-{width}x{height}.jpg"},"channel":{"mature":false,"status":"!uptime !drop !prime [24/7 Streams Being Attempted] !Streamlegends","broadcaster_language":"en","display_name":"justalazygamer","game":"The Elder Scrolls: Legends","language":"en","_id":108772101,"name":"justalazygamer","created_at":"2015-12-05T17:12:22.623394Z","updated_at":"2017-10-11T18:06:02.14856Z","partner":true,"logo":"https://static-cdn.jtvnw.net/jtv_user_pictures/5c40f666748e0f40-profile_image-300x300.jpeg","video_banner":null,"profile_banner":"https://static-cdn.jtvnw.net/jtv_user_pictures/45ec516aae4409ff-profile_banner-480.png","profile_banner_background_color":"","url":"https://www.twitch.tv/justalazygamer","views":487415,"followers":12395,"broadcaster_type":"","description":"I enjoy playing game, I just get lazy about it sometimes."}}]}

Without a Client-ID…

curl -H 'Accept: application/vnd.twitchtv.v5+json' -X GET https://api.twitch.tv/kraken/streams?game=The+Elder+Scrolls:+Legends\&limit=1\&stream_type=live
{"error":"Bad Request","status":400,"message":"No client id specified"}

Just like you show above as an error.

i tried that postman same thing.

it work. but nodejs not work.but call ‘~kraken/games/top?limit=100’ is work

I dont know if ClockWise has the same problem.

But in your case, leesm0218, you need to add the client id of your developer application ( https://dev.twitch.tv/dashboard/apps ) in the header of your request.

I not really familiar with python, but in php you can add it this way:

$ch = curl_init();
curl_setopt_array($ch, array(
	CURLOPT_HTTPHEADER => array(
		'Client-ID: ' . "[[YOUR CLIENT ID]]"
				),
	CURLOPT_RETURNTRANSFER => true,
	CURLOPT_URL => "[[URL]]"
));
$output = curl_exec($ch);
1 Like

Can you show me your NodeJS code – be sure to obfuscate any Client IDs or OAuth keys if they are present.

Thanks for the help, my clientID changed for some reason. As I said, I haven’t changed the code for 12 days and I’ve been running this script once every hour since I last changed the code. But yesterday I changed my twitch account nickname, so that might have caused the issue.

Anyway, after updating my clientID it now works again. Thanks everyone!

1 Like

nevermind. it’s my fault.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.