chrippa / livestreamer

Command-line utility that extracts streams from various services and pipes them into a video player of choice. No longer maintained, use streamlink or youtube-dl instead.
http://livestreamer.io/
BSD 2-Clause "Simplified" License
3.88k stars 579 forks source link

Twitch API changes? #1456

Open dMolite opened 8 years ago

dMolite commented 8 years ago

~~Every stream which i try to open with livestreamer i'm getting: [cli][info] Found matching plugin twitch for URL twitch.tv/dansgaming error: Unable to open URL: https://api.twitch.tv/api/channels/dansgaming/access_token.json (400 Client Error: Bad Request)~~

Json token: {"error":"Bad Request","status":400,"message":"No client id specified"}

Edit: nvm

Dragovorn commented 8 years ago

This is likely caused by the latest change to the twitch api, (I'm not 100% certain so don't quote me on this) https://blog.twitch.tv/client-id-required-for-kraken-api-calls-afbb8e95f843#.x9dk0wl5l and apparently the calls that livestreamer is using just got added to kraken or something, once again not an expert on twitch api stuff.

EDIT: Seems like it was just a twitch side issue.

casillias commented 8 years ago

Seems like issue already solved

hobbldygoop commented 8 years ago

Seems twitch tested that client-id requirement for a bit but rolled it back again quickly, but still seems they are gonna make that permanent at some point soon™.

https://discuss.dev.twitch.tv/t/client-id-requirement-faqs/6108/40

anlutro commented 8 years ago

I'm running into this problem now.

DashKrimson commented 8 years ago

Yeah, I'm having issues now with Livestreamer, and I think this might be it. Could it be related to the HTML5 rollout? It was working fine just an hour ago.

Time for a hotfix, methinks.

And now it's working again. Super-quick hotfix, or Twitch-side futz-up? I'll let you be the judge.

skulblakka commented 8 years ago

Super-quick hotfix

unlikely as this project has not been updated in a while

Twitch-side futz-up

This is most likely because of the upcoming changes to the Twitch API which will require all usage of the Kraken API (which livestreamer is using) using a valid Client ID otherwise you will receive code 400.

According to this they made some tests of the changes about a week ago. They might have done another one yesterday breaking livestreamer again.

However the twitch plugin will definitely require a update when this change goes live permanently.

basepi commented 8 years ago

I'm hitting this today. Has the client id requirement gone live?

foxxx0 commented 8 years ago

me too.

cbirchinger commented 8 years ago

Yeah it's back. It happened 2-3 times so far. Usually for 1-2 hours. I was hopping that they at least go full HTML5 before blocking the only usable player on my system (livestreamer).

basepi commented 8 years ago

Agreed, the browser player is terrible. I love my IRC/livestreamer setup.

Will livestreamer be able to support the client id?

ghost commented 8 years ago

Experiencing this issue tooright now, it will really suck if we won't be able to use livestreamer for Twitch anymore. I tried to find some extensions to turn the Twitch player into html5 but they don't seem to work, also Firefox has a weird Twitch player that seems html5 friendly but I am not sure

cbirchinger commented 8 years ago

client-id shouldn't be hard to implement. It's basically just sending additional HTTP header that also someone whitelisted on the Twitch site (they released a howto on their page).

The problem at this point is more that the project seems abandoned and someone else has to step up and implement it.

Rika-chan commented 8 years ago

So it seems, unfortunately, @cbirchinger

davicdsalves commented 8 years ago

So any suggestion on an alternative for livestreamer? livestreamer+chatty was my way to go :/

mooseh commented 8 years ago

twitchstatus.com The api is down at the moment, not matter what request you send its returning 400 no client id specified, im using OAuth and I am specifying a client id - confirmed http://twitchstatus.com/

duckmammal commented 8 years ago

Just looking for a plain English answer here. Is this error due to twitch api being down, or due to livestreamer no longer interfacing properly with the twitch api?

SEQUOIIA commented 8 years ago

@duckmammal The 2nd reason - https://discuss.dev.twitch.tv/t/client-id-requirement-faqs/6108/43

sgt-kabukiman commented 8 years ago

I just hit the same issue with horaro. Adding the Client-ID header fixed the issue immediately.

dhelfrich commented 8 years ago

There is actually a fix

Step 1. Type livestreamer --twitch-oauth-authenticate. Chrome will open and ask you to login to twitch. It will give you a "page does not exist" error. Step 2. Check the url. It has a section that says access_token=xxxxxxxxxxxxxxxxxxxxxxxx. Copy this string. Step 3. Continue watching livestreamer as usual. However, when opening a stream, it should read livestreamer --twitch-oauth-token xxxxxxxxxxxxxxxxxxxx twitch.tv/channel best

cbirchinger commented 8 years ago

@sgt-kabukiman why not post a patch with the added Client-ID code here?

Shilag commented 8 years ago

@dhelfrich That is a nice workaround, thanks for that. I sure hope that's only temporary though. I don't particularly want to set up a .bat for every single stream I ever watch. I like being able to just quickly type in the url and running it right away.

duckmammal commented 8 years ago

@dhelfrich I appreciate the comment! I was able to get through Step 1. On step two you say "Check the url. It has a section that says access_token=xxxxxxxxxxxxxxxxxxxxxxxx."

I don't know what is meant by this. Here are some example urls that I'm interested in viewing: https://www.twitch.tv/calebdmtg/v/89245345 https://www.twitch.tv/theokoles

I opened up the page source in these webpages, and searched for the terms "access", "token" and "access_token" but these did not return any hits. I'm wondering if you could clarify how to find the access_token you're talking about from Step 2.

Thanks!

blackdotsh commented 8 years ago

--twitch-oauth-authenticate didn't work for me. Another way to get your oauth token is by going to http://www.twitchapps.com/tmi/ and it'll give you your oauth token. Your token is the value after "oauth:" so copy everything after the ":"

Then follow the steps 2 & 3 provided by @dhelfrich

duckmammal commented 8 years ago

@dhelfrich and @blackdotsh thanks I've got it now!

dhelfrich commented 8 years ago

@Shilag You can set up a config file with the access token in it. Unfortunately you still need to type. --config FILE. I do hope the access tokens never expire too.

Barbossa42 commented 8 years ago

To avoid having the long token in the run command, you can set it up in the config as well. There is a default location for a livestreamer config to be made, even without --config see here: http://docs.livestreamer.io/cli.html#configuration-file

if you go to %appdata%/roaming/livestreamer (or wherever your livestreamer config is located) you can edit the livestreamerrc file in notepad (or whatever config editing tool you prefer) and add the line: twitch-oauth-token=(paste token here without parenthesis)

then save the config, and it should run fine. The config option was listed here: http://docs.livestreamer.io/cli.html#example

This was set up in case we wanted to view sub only content originally, but it saved our hide now.

Shilag commented 8 years ago

@Barbossa42 That worked perfectly. Thank you so much!

DashKrimson commented 8 years ago

@Barbossa42 Unfortunately, I use LiveStreamer with TwitchFox to quickly and easily switch between streams, so your solution won't work for me, since I'm assuming that the tokens are for single streams only? So I guess I'll have to wait for a new version of LiveStreamer or a patch to come out, since your solution, cool though it is, sounds like much too much work for my lazy ass.

Great work regardless.

Barbossa42 commented 8 years ago

@DashKrimson No, these tokens are for your account. it authenticates that you are you, and lets you use everything as normal. My solution should work for you fine, since I switch between streams often as well, and since implementing this fix, I have not had any issues.

The tokens are something you activate on your account, like joining it with steam, or the mobile twitch app. Once it is created, that oauth token shows that the request is tied to your account, and so it lets it through.

upon using the fix it will show something along the lines of "attempting to use oauth token, verified as user 'username here'" in the command line for livestreamer.

Be sure to use dhelfrich's portion of the solution above, that takes you to the point of getting your oauth token for Livestreamer.

To have the guide consolidated into one place, I think i'll put it below (thanks to @dhelfrich for the first part):

Step 1. Type livestreamer --twitch-oauth-authenticate. Chrome will open and ask you to login to twitch. It will give you a "page does not exist" error. be sure not to close this page until after you have made sure the fix works in case you need the token again

Step 2. Check the url. It has a section that says access_token=(string of characters)&Scope. Copy the token contents section between the = and the &. For example if it is access_token=12345ABCDEabcde&Scope you end up with 12345ABCDEabcde

step 3. go to your appdata folder for livestreamer listed here http://docs.livestreamer.io/cli.html#configuration-file This should be something like users/(username)/appdata/roaming/livestreamer

step 4. open the livestreamerrc file in notepad and scroll all the way to the bottom.

step 5. on a new line, put: twitch-oauth-token= and paste the string of character after the = with no space between them example: twitch-oauth-token=12345ABCDEabcde

step 6. Save the file and try opening a stream as you usually do.

DashKrimson commented 8 years ago

@Barbossa42 Oh! That's great then, thanks! I'll go and try this out now!

EDIT: Odd. When the command prompt comes up, it says that it failed to authenticate the token, but then opens the stream as it usually does. Do you think the mere act of having a token is enough? Either way, it works again now, so thanks again!

jonathantimm commented 8 years ago

I'm having this issue now. My ajax requests are still working in my app, but only in requesting info on streams, not on users. The users requests aren't working at all. Also, I'm a noob.

mule42 commented 8 years ago

I have an altered twitch plugin that functions, but probably not as intended. I'm not sure what livestreamer's actual client_id should be. twitch.py.patch.txt

solocshaw commented 8 years ago

@Barbossa42 Works like a charm. Thanks!

HASJ commented 8 years ago

https://www.twitch.tv/ripstonegames/v/88409672

livestreamer https://www.twitch.tv/ripstonegames/v/88409672 best

Not working.

Barbossa42 commented 8 years ago

that's because you should be putting: livestreamer twitch.tv/ripstonegames/v/88409672 best

you don't put https://www. in the run command. It seems to work fine for me with this command.

ygra commented 8 years ago

@Barbossa42 Both should work identically.

Barbossa42 commented 8 years ago

confirmed both work identically. I always had trouble getting it to work with anything before twitch.tv added before. hm. Not sure why it struggled to run with it for me before, I can't seem to find anything significant that would cause problems when testing it.

Akandesh commented 8 years ago

I've just updated my GUI with a fix that works! Try it out for yourselves at http://files.akandesh.com/Programs/ It's called Livestreamer.exe and looks like this: https://i.gyazo.com/36c0da645899530d66a95c5112118a77.png

I have the source on my github :)

This was my project on the side while I was learning Programming 1 in Java in school. Seems like I will have to redo a ton of things if this workaround does not work well.

jspraul commented 8 years ago

As of 13 hours ago, the Client-ID http header is all that is required, not your personal OAuth token. This could obviously change any time.

https://github.com/chrippa/livestreamer/issues/1478#issuecomment-247242827

jwd83 commented 8 years ago

For those using linux/raspberry pi a quick bash file can automate a lot of this...

#!/usr/bin/env bash
livestreamer --twitch-oauth-token xxxxxxxxxxxxxxxxxxxxxx twitch.tv/$1 best -np 'omxplayer'

Similar could be done with a quick .bat file in windows as well.

I have this saved as watchtwitch in my home directory. Simply ~/watchtwitch LIRIK or ~/watchtwitch playhearthstone. Don't forget to chmod +x this file

If you don't need to force omxplayer can simply remove the "-np omxplayer". I have this in for raspberry pi support.

acccounttest commented 8 years ago

FINALLY ONLY WORKS LIKE THIS: livestreamer --twitch-oauth-token xxx twitch.tv/dilmitri best --player-passthrough hls

i try this before try update program and won't works: C:\Users\sph>livestreamer --twitch-oauth-token xxx twitch.tv/dilmitri best [cli][info] Found matching plugin twitch for URL twitch.tv/dilmitri [plugin.twitch][info] Attempting to authenticate using OAuth token [plugin.twitch][error] Failed to authenticate, the access token is invalid or mi ssing required scope error: Unable to open URL: https://api.twitch.tv/api/channels/dilmitri/access_to ken.json (400 Client Error: Bad Request) EDIT: that works to authenticate but player say from stdin cannot read file Step 1. Type livestreamer --twitch-oauth-authenticate. Chrome will open and ask you to login to twitch. It will give you a "page does not exist" error. FeelsBadMan Step 2. Check the url. It has a section that says access_token=xxxxxxxxxxxxxxxxxxxxxxxx. Copy this string. Step 3. Continue watching livestreamer as usual. However, when opening a stream, it should read livestreamer --twitch-oauth-token xxxxxxxxxxxxxxxxxxxx twitch.tv/channel best