diff options
author | Celthi <txtlu0@gmail.com> | 2015-12-12 11:21:44 +0800 |
---|---|---|
committer | Celthi <txtlu0@gmail.com> | 2015-12-12 11:21:44 +0800 |
commit | 14c17cafa18292112e5ea09e23f8598892ab3a0b (patch) | |
tree | a4967be75279f1926627ad8859110d1841f91289 /youtube_dl | |
parent | 8696a7fd1396e051a3762ff241d1b4e157b7b08a (diff) |
add support to video protected by password
Diffstat (limited to 'youtube_dl')
-rw-r--r-- | youtube_dl/extractor/youku.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/youtube_dl/extractor/youku.py b/youtube_dl/extractor/youku.py index 9fd0e1e23..f1bb482c3 100644 --- a/youtube_dl/extractor/youku.py +++ b/youtube_dl/extractor/youku.py @@ -219,25 +219,25 @@ class YoukuIE(InfoExtractor): # request basic data basic_data_url = "http://play.youku.com/play/get.json?vid=%s&ct=12" % video_id if video_password: - basic_data_url += '?password=%s' % video_password + basic_data_url += '&pwd=%s' % video_password data1 = retrieve_data( basic_data_url, 'Downloading JSON metadata 1') data2 = retrieve_data( - "http://play.youku.com/play/get.json?vid=%s&ct=12" % video_id, + basic_data_url, 'Downloading JSON metadata 2') - error_code = data1.get('error_code') - if error_code: - error = data1.get('error') - if error is not None and '因版权原因无法观看此视频' in error: + error = data1.get('error') + if error: + error_note = error.get('note') + if error_note is not None and '因版权原因无法观看此视频' in error_note: raise ExtractorError( 'Youku said: Sorry, this video is available in China only', expected=True) else: - msg = 'Youku server reported error %i' % error_code + msg = 'Youku server reported error %i' % error.get('code') if error is not None: - msg += ': ' + error + msg += ': ' + error_note raise ExtractorError(msg) #get video title |