mIRC Home    About    Download    Register    News    Help

Print Thread
[Twitch] Get Twitch nick #262665 09/03/18 01:08 PM
Joined: Mar 2018
Posts: 9
S
Smokofenek Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
S
Joined: Mar 2018
Posts: 9
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.

Re: [Twitch] Get Twitch nick [Re: Smokofenek] #262690 13/03/18 07:11 PM
Joined: Oct 2015
Posts: 112
B
Blas Offline
Vogon poet
Offline
Vogon poet
B
Joined: Oct 2015
Posts: 112
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))
}

Last edited by Blas; 13/03/18 07:13 PM.
Re: [Twitch] Get Twitch nick [Re: Blas] #262693 14/03/18 07:55 PM
Joined: Mar 2018
Posts: 9
S
Smokofenek Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
S
Joined: Mar 2018
Posts: 9
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 ^^;

Re: [Twitch] Get Twitch nick [Re: Smokofenek] #262698 15/03/18 01:04 AM
Joined: Oct 2015
Posts: 112
B
Blas Offline
Vogon poet
Offline
Vogon poet
B
Joined: Oct 2015
Posts: 112
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

Re: [Twitch] Get Twitch nick [Re: Blas] #262720 19/03/18 06:39 PM
Joined: Mar 2018
Posts: 9
S
Smokofenek Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
S
Joined: Mar 2018
Posts: 9
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?