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

Use client ID for twitch.tv API calls #1483

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/livestreamer/plugins/twitch.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
}


TWITCH_CLIENT_ID="ewvlchtxgqq88ru9gmfp1gmyt6h2b93"

_url_re = re.compile(r"""
http(s)?://
(?:
Expand Down Expand Up @@ -171,7 +173,7 @@ def call(self, path, format="json", schema=None, **extra_params):
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)
Expand Down
3 changes: 2 additions & 1 deletion src/livestreamer_cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -531,7 +532,7 @@ def authenticate_twitch_oauth():
"""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="
Expand Down