-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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] Switch access token to GraphQL and refactor. #27646
Conversation
youtube_dl/extractor/twitch.py
Outdated
def _download_vod_access_token_gql(self, video_id): | ||
return self._download_access_token_gql( | ||
video_id, 'videoPlaybackAccessToken', 'id', | ||
'Downloading %s access token JSON GraphQL' % video_id) | ||
|
||
def _download_stream_access_token_gql(self, channel_name): | ||
return self._download_access_token_gql( | ||
channel_name, 'streamPlaybackAccessToken', 'channelName', | ||
'Downloading access token JSON GraphQL') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inline.
Can anyone here help me? I am trying to hit the endpoint as specified in the code but I am not getting an access token back as the 'value' but rather a json object...
I am using the same Client-ID that was working with the old api. |
'value' you got is a string, the same as 'value' from using old API. |
Aha thanks @TaoziDB it works, i just had to uri encode it for the next call. |
Before submitting a pull request make sure you have:
In order to be accepted and merged into youtube-dl each piece of code must be in public domain or released under Unlicense. Check one of the following options:
What is the purpose of your pull request?
Description of your pull request and other information
The main purpose of this PR is switching endpoint for the access token from the old
api.twitch.tv/api
to the newest GraphQL.Looks like the
api.twitch.tv/api
endpoint is still working, but it will be rejected at any time. Thetwitch.tv
frontend already uses GraphQL requests to get the access token.Side changes:
Removed unused_download_access_token
method.TwitchGraphQLBaseIE
class to the top afterTwitchBaseIE
class._download_base_gql
method to make general GraphQL requests and remove repeatedhttps://gql.twitch.tv/gql
endpoint strings.I am open to suggestions for improving the code of this PR.