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

Can't download from twitch #10660

Closed
yancylee99 opened this issue Sep 15, 2016 · 0 comments
Closed

Can't download from twitch #10660

yancylee99 opened this issue Sep 15, 2016 · 0 comments

Comments

@yancylee99
Copy link

@yancylee99 yancylee99 commented Sep 15, 2016

I did it like this:
I applied quick fix locally. Also noticed that headers were not passed through so removed not needed ones (question is if Twitch-Api-Token is needed, it was working without it for some time). Youtube-dl should have it's own client-id probably instead of using web player one. Tho it is not for me to decide.

If someone wants quick fix until it is fixed in trunk:

diff --git a/youtube_dl/extractor/twitch.py b/youtube_dl/extractor/twitch.py
index 359a885..f393ab1 100644
--- a/youtube_dl/extractor/twitch.py
+++ b/youtube_dl/extractor/twitch.py
@@ -45,14 +45,13 @@ class TwitchBaseIE(InfoExtractor):

 def _call_api(self, path, item_id, note):
     headers = {
  •        'Referer': 'http://api.twitch.tv/crossdomain/receiver.html?v=2',
    
  •        'X-Requested-With': 'XMLHttpRequest',
    
  •        'Client-ID': 'jzkbprff40iqj646a697cyrvl0zt2m6',
     }
     for cookie in self._downloader.cookiejar:
         if cookie.name == 'api_token':
             headers['Twitch-Api-Token'] = cookie.value
     response = self._download_json(
    
  •        '%s/%s' % (self._API_BASE, path), item_id, note)
    
  •        '%s/%s' % (self._API_BASE, path), item_id, note, headers=headers)
     self._handle_error(response)
     return response
    
    But it still shows this:
    root@debian:~# youtube-dl -v https://www.twitch.tv/a_seagull/v/89333620?sr=a
    Traceback (most recent call last):
    File "/usr/local/bin/youtube-dl", line 7, in
    from youtube_dl import main
    File "/usr/local/lib/python2.7/dist-packages/youtube_dl/init.py", line 42, in
    from .extractor import gen_extractors, list_extractors
    File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/init.py", line 9, in
    from .extractors import *
    File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/extractors.py", line 951, in
    from .twitch import (
    File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/twitch.py", line 54
    /%s' % (self._API_BASE, path), item_id, note, headers = headers)
    ^
    SyntaxError: invalid syntax
@dstftw dstftw closed this in 95be29e Sep 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.