Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Twitch - Unable to open URL #1478

Open
X-Looper opened this issue Sep 14, 2016 · 29 comments
Open

Twitch - Unable to open URL #1478

X-Looper opened this issue Sep 14, 2016 · 29 comments

Comments

@X-Looper
Copy link

Is anyone else experiencing problems watching Streams on Twitch with Livestreamer right now?

It was working just fine yesterday and now I'm getting the following error message while trying to watch any/all Streams:

error: Unable to open URL: https://api.twitch.tv/api/channels/channel_name/access_token.json <400 Client Error: Bad Request>

@cbirchinger
Copy link

See #1456

@mooseh
Copy link

mooseh commented Sep 14, 2016

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/

@X-Looper
Copy link
Author

Thanks for the input guys, appreciated!

@Baerht
Copy link

Baerht commented Sep 15, 2016

https://www.reddit.com/r/Twitch/comments/52ta5d/twitch_api_clientid_enforcement_is_now_live_what/

@mjevans
Copy link

mjevans commented Sep 15, 2016

This guide is a little better (also on Reddit, and I think linked from the thing Baerht posted)

https://www.reddit.com/r/Twitch/comments/52sye3/livestreamer_help_please_help/d7n0j36

Edit:

Also, how is Twitch doing 'not logged in' users? Are they forcing everyone to sign up now?

@LoneFox78
Copy link

Also, how is Twitch doing 'not logged in' users? Are they forcing everyone to sign up now?

There are two kinds of tokens, client-specific and user-specific. You need only one of them. For example, livestreamer --http-header Client-ID=jzkbprff40iqj646a697cyrvl0zt2m6 works (It is the token used by their own web player).

@hodor22
Copy link

hodor22 commented Sep 15, 2016

this workarround helped me to make it work again
https://www.reddit.com/r/Twitch/comments/52sye3/livestreamer_help_please_help/d7n0j36
thax@mjevans

@steven7851
Copy link
Contributor

steven7851 commented Sep 15, 2016

@LoneFox78
Add http-header is working fine for me,
and livestreamer's client-id is "ewvlchtxgqq88ru9gmfp1gmyt6h2b93".
Find it at livestreamer_cli/main.py#L534.

@CowCowCowCow
Copy link

@LoneFox78
This works great via a terminal but I can't get it working from livestreamerrc.
Any ideas? Thank you

@skulblakka
Copy link
Contributor

Are you sure? You should be able to use all command line options as a option in the config file.

@LoneFox78
Copy link

I don't really know python, but I got this working based on what youtube-dl does:

diff -bur livestreamer-20160315-orig/src/livestreamer/plugins/twitch.py livestreamer-20160315/src/livestreamer/plugins/twitch.py
--- livestreamer-20160315-orig/src/livestreamer/plugins/twitch.py   2016-03-15 06:28:45.000000000 +0200
+++ livestreamer-20160315/src/livestreamer/plugins/twitch.py    2016-09-15 20:56:25.000000000 +0300
@@ -27,6 +27,8 @@
 }


+TWITCH_CLIENT_ID="ewvlchtxgqq88ru9gmfp1gmyt6h2b93"
+
 _url_re = re.compile(r"""
     http(s)?://
     (?:
@@ -171,7 +173,7 @@
         url = "https://{0}.twitch.tv{1}.{2}".format(self.subdomain, path, format)

         # The certificate used by Twitch cannot be verified on some OpenSSL versions.
-        res = http.get(url, params=params, verify=False)
+        res = http.get(url, params=params, verify=False, headers={'Client-ID': TWITCH_CLIENT_ID})

         if format == "json":
             return http.json(res, schema=schema)
diff -bur livestreamer-20160315-orig/src/livestreamer_cli/main.py livestreamer-20160315/src/livestreamer_cli/main.py
--- livestreamer-20160315-orig/src/livestreamer_cli/main.py 2016-03-15 06:28:45.000000000 +0200
+++ livestreamer-20160315/src/livestreamer_cli/main.py  2016-09-15 20:47:15.000000000 +0300
@@ -15,6 +15,7 @@
                           NoPluginError)
 from livestreamer.cache import Cache
 from livestreamer.stream import StreamProcess
+from livestreamer.plugins.twitch import TWITCH_CLIENT_ID

 from .argparser import parser
 from .compat import stdout, is_win32
@@ -531,7 +532,7 @@
     """Opens a web browser to allow the user to grant Livestreamer
        access to their Twitch account."""

-    client_id = "ewvlchtxgqq88ru9gmfp1gmyt6h2b93"
+    client_id = TWITCH_CLIENT_ID
     redirect_uri = "http://livestreamer.tanuki.se/en/develop/twitch_oauth.html"
     url = ("https://api.twitch.tv/kraken/oauth2/authorize/"
            "?response_type=token&client_id={0}&redirect_uri="

@4jb
Copy link

4jb commented Sep 15, 2016

Those having issues with livestreamerrc, this is the exact line I added to make it work again:

http-header=Client-ID=ewvlchtxgqq88ru9gmfp1gmyt6h2b93

Personally, I prefer to not show up in the viewer list when using LiveStreamer, but that's just me.

@CowCowCowCow
Copy link

@4jb
Thanks, for some reason it's working fine on windows but not linux.. probably my fault anyway.

@javiercantero
Copy link
Contributor

javiercantero commented Sep 16, 2016

@LoneFox78 Maybe you don't know python but your patch is correct. :) Could you please fork the livestreamer repo and create a branch with your changes? (a Pull Request will be even better). I want to pull your patch to my repo while keeping your authorship (because there are other changes that I want to apply upon it).

@gravyboat
Copy link

gravyboat commented Sep 16, 2016

For those of you who just want an example using the client ID:

livestreamer --http-header Client-ID=jzkbprff40iqj646a697cyrvl0zt2m6 twitch.tv/streamer best

@LoneFox78
Copy link

@javiercantero Done. For some reason it does not allow me to select your repository for the pull request, so I made it for this (chrippa's) repo instead. At least this way it is in the same place as all other accumulated fixes...

@javiercantero
Copy link
Contributor

@LoneFox78 Perfect. From there, chrippa can merge it into upstream and also the rest of us can get the patch. Thank you.

@gravyboat
Copy link

@javiercantero, @chrippa no longer maintains this repo in any way, he hasn't merged a PR in over 6 months.

@RainOne
Copy link

RainOne commented Sep 16, 2016

@gravyboat Oh no, really? Where is the to-go version of livestreamer then? (did anybody fork and is maintaining it or this is still the best version?)

@gravyboat
Copy link

@RainOne It was just forked today over here: https://github.com/streamlink/streamlink you can see more regarding that discussion here: #1427

@javiercantero
Copy link
Contributor

@gravyboat The last time @chrippa merged patches also happened after a 5 months period without activity, so IMHO it's too soon to declare the project unmaintained. But it's true that it's not looking good.

aksarkar added a commit to aksarkar/dotfiles that referenced this issue Sep 18, 2016
@gravyboat
Copy link

@javiercantero As I said in another thread I contacted him in every way possible I could find, and even offered to pay him to merge in some of the more essential PRs to keep things going and he never responded. He is still active on GitHub.

@nxtreaming
Copy link

It seems that this good project has been dead.
I will study the code firstly.

@vadosnaprimer
Copy link

What would be the correct ID anyway, ewvlchtxgqq88ru9gmfp1gmyt6h2b93 or jzkbprff40iqj646a697cyrvl0zt2m6?

@lewisje
Copy link

lewisje commented Sep 19, 2016

This works for me, in livestreamerrc:

http-header=Client-ID=jzkbprff40iqj646a697cyrvl0zt2m6

This is the variant for command-line usage:

livestreamer --http-header Client-ID=jzkbprff40iqj646a697cyrvl0zt2m6

One of these is necessary if, like me, you got a localized display name and found that Livestreamer can't deal with non-ASCII display names.

@javiercantero
Copy link
Contributor

@vadosnaprimer One is the livestreamer own ID, another is the Twitch client ID. Both should work.

@wildgoosespeeder
Copy link

wildgoosespeeder commented Sep 25, 2016

Boy, am I glad there is a work-around without requiring a livestreamer update! The required pieces were already there.

"livestreamer --twitch-oauth-authenticate"

@naimbouallagui
Copy link

i have the same problem now !!

didn’t get the access to this link to get the data (TwitchTV project)
https://api.twitch.tv/kraken/users/freecodecamp/follows/ :
and this is the problem:
GET https://api.twitch.tv/kraken/users/freecodecamp/follows/ 404 ()
can any one help me !!
Thanks…

@lewisje
Copy link

lewisje commented Nov 16, 2017

That isn't relevant to this issue, but I'll help out anyway; the API endpoints have changed: https://dev.twitch.tv/docs/api/reference#get-users

First you need a valid OAuth token or Client ID: https://dev.twitch.tv/docs/authentication

Next, use this URL, appending the token or client ID parameter, to find the User ID for freecodecamp: https://api.twitch.tv/helix/users?login=freecodecamp

Finally, this is how you get the follows: https://dev.twitch.tv/docs/api/reference#get-users-follows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests