From a8391b4648a1ba0fbc041adec07baeedaa456e0a Mon Sep 17 00:00:00 2001 From: FindHao Date: Wed, 24 Apr 2019 10:31:16 +0800 Subject: [PATCH 1/2] fix token not in video infor bug --- youtube_dl/extractor/youtube.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/youtube_dl/extractor/youtube.py b/youtube_dl/extractor/youtube.py index 67eceb5c4..8bcd57d83 100644 --- a/youtube_dl/extractor/youtube.py +++ b/youtube_dl/extractor/youtube.py @@ -1677,9 +1677,10 @@ class YoutubeIE(YoutubeBaseInfoExtractor): unavailable_message = 'Unable to extract video data' raise ExtractorError( 'YouTube said: %s' % unavailable_message, expected=True, video_id=video_id) - if 'token' not in video_info: - if 'reason' in video_info: + if 'account_playback_token' in video_info: + video_info['token'] = video_info['account_playback_token'] + elif 'reason' in video_info: if 'The uploader has not made this video available in your country.' in video_info['reason']: regions_allowed = self._html_search_meta( 'regionsAllowed', video_webpage, default=None) From e1da6703d1c26d637b847c2ed98f2a866adfe6dc Mon Sep 17 00:00:00 2001 From: FindHao Date: Wed, 24 Apr 2019 10:54:20 +0800 Subject: [PATCH 2/2] add indents --- youtube_dl/extractor/youtube.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/extractor/youtube.py b/youtube_dl/extractor/youtube.py index 8bcd57d83..cb364ce30 100644 --- a/youtube_dl/extractor/youtube.py +++ b/youtube_dl/extractor/youtube.py @@ -1679,7 +1679,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor): 'YouTube said: %s' % unavailable_message, expected=True, video_id=video_id) if 'token' not in video_info: if 'account_playback_token' in video_info: - video_info['token'] = video_info['account_playback_token'] + video_info['token'] = video_info['account_playback_token'] elif 'reason' in video_info: if 'The uploader has not made this video available in your country.' in video_info['reason']: regions_allowed = self._html_search_meta(