mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-01-07 17:16:08 +00:00
[twitch] Set OAuth token for GraphQL requests using auth-token cookie (#27790)
Co-authored-by: remitamine <remitamine@gmail.com>
This commit is contained in:
parent
8e5477d036
commit
879866a230
|
@ -138,13 +138,17 @@ class TwitchBaseIE(InfoExtractor):
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
def _download_base_gql(self, video_id, ops, note, fatal=True):
|
def _download_base_gql(self, video_id, ops, note, fatal=True):
|
||||||
return self._download_json(
|
|
||||||
'https://gql.twitch.tv/gql', video_id, note,
|
|
||||||
data=json.dumps(ops).encode(),
|
|
||||||
headers = {
|
headers = {
|
||||||
'Content-Type': 'text/plain;charset=UTF-8',
|
'Content-Type': 'text/plain;charset=UTF-8',
|
||||||
'Client-ID': self._CLIENT_ID,
|
'Client-ID': self._CLIENT_ID,
|
||||||
}, fatal=fatal)
|
}
|
||||||
|
gql_auth = self._get_cookies('https://gql.twitch.tv').get('auth-token')
|
||||||
|
if gql_auth:
|
||||||
|
headers['Authorization'] = 'OAuth ' + gql_auth.value
|
||||||
|
return self._download_json(
|
||||||
|
'https://gql.twitch.tv/gql', video_id, note,
|
||||||
|
data=json.dumps(ops).encode(),
|
||||||
|
headers=headers, fatal=fatal)
|
||||||
|
|
||||||
def _download_gql(self, video_id, ops, note, fatal=True):
|
def _download_gql(self, video_id, ops, note, fatal=True):
|
||||||
for op in ops:
|
for op in ops:
|
||||||
|
|
Loading…
Reference in a new issue