mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 20:46:36 -05:00
[twitch] Update cliend id and modernize (closes #17126)
This commit is contained in:
parent
48afc6ca3e
commit
cb1c3a3c07
1 changed files with 8 additions and 14 deletions
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..compat import (
|
from ..compat import (
|
||||||
compat_HTTPError,
|
|
||||||
compat_kwargs,
|
compat_kwargs,
|
||||||
compat_parse_qs,
|
compat_parse_qs,
|
||||||
compat_str,
|
compat_str,
|
||||||
|
@ -39,7 +38,7 @@ class TwitchBaseIE(InfoExtractor):
|
||||||
_USHER_BASE = 'https://usher.ttvnw.net'
|
_USHER_BASE = 'https://usher.ttvnw.net'
|
||||||
_LOGIN_FORM_URL = 'https://www.twitch.tv/login'
|
_LOGIN_FORM_URL = 'https://www.twitch.tv/login'
|
||||||
_LOGIN_POST_URL = 'https://passport.twitch.tv/login'
|
_LOGIN_POST_URL = 'https://passport.twitch.tv/login'
|
||||||
_CLIENT_ID = 'jzkbprff40iqj646a697cyrvl0zt2m6'
|
_CLIENT_ID = 'kimne78kx3ncx6brgo4mv6wki5h1ko'
|
||||||
_NETRC_MACHINE = 'twitch'
|
_NETRC_MACHINE = 'twitch'
|
||||||
|
|
||||||
def _handle_error(self, response):
|
def _handle_error(self, response):
|
||||||
|
@ -84,20 +83,15 @@ def login_step(page, urlh, note, data):
|
||||||
headers = {
|
headers = {
|
||||||
'Referer': page_url,
|
'Referer': page_url,
|
||||||
'Origin': page_url,
|
'Origin': page_url,
|
||||||
'Content-Type': 'text/plain;charset=UTF-8'
|
'Content-Type': 'text/plain;charset=UTF-8',
|
||||||
}
|
}
|
||||||
|
|
||||||
try:
|
response = self._download_json(
|
||||||
response = self._download_json(
|
post_url, None, note, data=json.dumps(form).encode(),
|
||||||
post_url, None, note,
|
headers=headers, expected_status=400)
|
||||||
data=json.dumps(form).encode(),
|
error = response.get('error_description') or response.get('error_code')
|
||||||
headers=headers)
|
if error:
|
||||||
except ExtractorError as e:
|
fail(error)
|
||||||
if isinstance(e.cause, compat_HTTPError) and e.cause.code == 400:
|
|
||||||
response = self._parse_json(
|
|
||||||
e.cause.read().decode('utf-8'), None)
|
|
||||||
fail(response.get('error_description') or response.get('error_code'))
|
|
||||||
raise
|
|
||||||
|
|
||||||
if 'Authenticated successfully' in response.get('message', ''):
|
if 'Authenticated successfully' in response.get('message', ''):
|
||||||
return None, None
|
return None, None
|
||||||
|
|
Loading…
Reference in a new issue