mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 03:03:01 +00:00
add support to video protected by password
This commit is contained in:
parent
8696a7fd13
commit
14c17cafa1
1 changed files with 8 additions and 8 deletions
|
@ -219,25 +219,25 @@ def retrieve_data(req_url, note):
|
||||||
# request basic data
|
# request basic data
|
||||||
basic_data_url = "http://play.youku.com/play/get.json?vid=%s&ct=12" % video_id
|
basic_data_url = "http://play.youku.com/play/get.json?vid=%s&ct=12" % video_id
|
||||||
if video_password:
|
if video_password:
|
||||||
basic_data_url += '?password=%s' % video_password
|
basic_data_url += '&pwd=%s' % video_password
|
||||||
|
|
||||||
data1 = retrieve_data(
|
data1 = retrieve_data(
|
||||||
basic_data_url,
|
basic_data_url,
|
||||||
'Downloading JSON metadata 1')
|
'Downloading JSON metadata 1')
|
||||||
data2 = retrieve_data(
|
data2 = retrieve_data(
|
||||||
"http://play.youku.com/play/get.json?vid=%s&ct=12" % video_id,
|
basic_data_url,
|
||||||
'Downloading JSON metadata 2')
|
'Downloading JSON metadata 2')
|
||||||
|
|
||||||
error_code = data1.get('error_code')
|
error = data1.get('error')
|
||||||
if error_code:
|
if error:
|
||||||
error = data1.get('error')
|
error_note = error.get('note')
|
||||||
if error is not None and '因版权原因无法观看此视频' in error:
|
if error_note is not None and '因版权原因无法观看此视频' in error_note:
|
||||||
raise ExtractorError(
|
raise ExtractorError(
|
||||||
'Youku said: Sorry, this video is available in China only', expected=True)
|
'Youku said: Sorry, this video is available in China only', expected=True)
|
||||||
else:
|
else:
|
||||||
msg = 'Youku server reported error %i' % error_code
|
msg = 'Youku server reported error %i' % error.get('code')
|
||||||
if error is not None:
|
if error is not None:
|
||||||
msg += ': ' + error
|
msg += ': ' + error_note
|
||||||
raise ExtractorError(msg)
|
raise ExtractorError(msg)
|
||||||
|
|
||||||
#get video title
|
#get video title
|
||||||
|
|
Loading…
Reference in a new issue