mIRC Homepage
Posted By: Smokofenek [Twitch] Get Twitch nick - 09/03/18 01:08 PM
Hello. I used to use some script to show nicks of people as they are on Twitch, instead of lowercase nick.

Code:
alias twitchname {
  if ($hget(nickformat) == $null) { hmake nickformat }
  if ($hget(nickformat,$1)) { return $iif($hget(nickformat,$1) == $null,$1,$hget(nickformat,$1)) }
  var %json https://api.twitch.tv/kraken/users/ $+ $1
  JSONOpen -ud nicename %json
  hadd nickformat $1 $json(nicename,display_name)
  return $iif($hget(nickformat,$1) == $null,$1,$hget(nickformat,$1))
}


I don't remember if this was using some additional thing, but if it did, I had this, cause I didn't change anything past few years. I have all scripts I had back then.

The problem is, it doesn't work anymore. I tried to go to https://api.twitch.tv/kraken/users/ page, but it seems "broken". At least doesn't show any user. No matter if I change users to user and what nick I wote, it just tells me either that not found or bad request. So there is a problem probably.

So what can I do to make the cript working again? Google doesn't say anything.

Thanks in advance.
Posted By: Blas Re: [Twitch] Get Twitch nick - 13/03/18 07:11 PM
You probably just need to supply a Client-ID. Twitch changed things sometime ago where you need to supply one now.

Example:

Code:
alias twitchname {
  if ($hget(nickformat) == $null) { hmake nickformat }
  if ($hget(nickformat,$1)) { return $iif($hget(nickformat,$1) == $null,$1,$hget(nickformat,$1)) }
  var %json https://api.twitch.tv/kraken/users/ $+ $1
  JSONOpen -uw nicename %json
  JSONHttpHeader nicename Client-ID YOUR_CLIENT_ID_HERE
  JSONHttpFetch nicename
  hadd nickformat $1 $json(nicename,display_name)
  JSONClose nicename
  return $iif($hget(nickformat,$1) == $null,$1,$hget(nickformat,$1))
}
Posted By: Smokofenek Re: [Twitch] Get Twitch nick - 14/03/18 07:55 PM
I don't get it. I mean, I know what You mean by registering but... how to do that. The blog You send me says I have to go to connections and at the bottom is the option to do it but... there isn't any? There is the link that dev API has been redirected. I have to go to dev.twitch.tv? Or what? Don't get the instructions that are not really the same as the reality...

And I have to have partnership to do that or sth? Pay for the thing or whatever?

I'm super newbie, so I really need the help ^^;
Posted By: Blas Re: [Twitch] Get Twitch nick - 15/03/18 01:04 AM
It's been a long time since I've registered an app there. It looks like they changed the process a bit. You're supposed to use your own Client-ID but I mean there's a lot of "public" ones that you find online. I have a bunch of scripts on my GitHub that use my own Client-ID so it's not like it's anything super secret. Feel free to use it if you can't figure out how to register an app: avm4vi7zv0xpjkpi3d4x0qzk8xbrdw8
Posted By: Smokofenek Re: [Twitch] Get Twitch nick - 19/03/18 06:39 PM
So I made an app by this tool. But what exactly should I put in OAuth Redirect URI? If I want the Twitch account bot, what should I write?
© mIRC Discussion Forums