diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2015-02-28 20:51:54 +0100 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2015-02-28 20:51:54 +0100 |
commit | 29cad7ad130c2e093c06d269c3b222e33adc218f (patch) | |
tree | 58d6b44e87712e9c461b83f892dbd7d173214eed /youtube_dl/extractor/twitch.py | |
parent | 1a2313a6f2d83c9e0a5c0c25bf5a2e3167994dbe (diff) | |
parent | 0d103de3b0b03c5027f0015327c2c44b9073513a (diff) |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'youtube_dl/extractor/twitch.py')
-rw-r--r-- | youtube_dl/extractor/twitch.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/youtube_dl/extractor/twitch.py b/youtube_dl/extractor/twitch.py index 4b0d8988d..4b0ce54df 100644 --- a/youtube_dl/extractor/twitch.py +++ b/youtube_dl/extractor/twitch.py @@ -34,7 +34,15 @@ class TwitchBaseIE(InfoExtractor): expected=True) def _download_json(self, url, video_id, note='Downloading JSON metadata'): - response = super(TwitchBaseIE, self)._download_json(url, video_id, note) + headers = { + 'Referer': 'http://api.twitch.tv/crossdomain/receiver.html?v=2', + 'X-Requested-With': 'XMLHttpRequest', + } + for cookie in self._downloader.cookiejar: + if cookie.name == 'api_token': + headers['Twitch-Api-Token'] = cookie.value + request = compat_urllib_request.Request(url, headers=headers) + response = super(TwitchBaseIE, self)._download_json(request, video_id, note) self._handle_error(response) return response |