mirror of
https://github.com/soimort/you-get.git
synced 2025-02-03 08:43:58 +03:00
[youku] handle password-protected videos, fix #73 (again)
This commit is contained in:
parent
6fdb9ca179
commit
d41b8a2a89
@ -118,10 +118,17 @@ class Youku(VideoExtractor):
|
|||||||
assert 'stream' in data
|
assert 'stream' in data
|
||||||
except:
|
except:
|
||||||
if 'error' in data:
|
if 'error' in data:
|
||||||
log.wtf('[Failed] ' + data['error']['note'])
|
if data['error']['code'] == -202:
|
||||||
|
# Password protected
|
||||||
|
self.password_protected = True
|
||||||
|
self.password = input(log.sprint('Password: ', log.YELLOW))
|
||||||
|
api_url += '&pwd={}'.format(self.password)
|
||||||
|
meta = json.loads(get_html(api_url))
|
||||||
|
data = meta['data']
|
||||||
|
else:
|
||||||
|
log.wtf('[Failed] ' + data['error']['note'])
|
||||||
else:
|
else:
|
||||||
log.wtf('[Failed] Video not found.')
|
log.wtf('[Failed] Video not found.')
|
||||||
# TBD: password protected?
|
|
||||||
|
|
||||||
self.title = data['video']['title']
|
self.title = data['video']['title']
|
||||||
self.ep = data['security']['encrypt_string']
|
self.ep = data['security']['encrypt_string']
|
||||||
@ -175,8 +182,7 @@ class Youku(VideoExtractor):
|
|||||||
|
|
||||||
if not kwargs['info_only']:
|
if not kwargs['info_only']:
|
||||||
if self.password_protected:
|
if self.password_protected:
|
||||||
password = input(log.sprint('Password: ', log.YELLOW))
|
m3u8_url += '&password={}'.format(self.password)
|
||||||
m3u8_url += '&password={}'.format(password)
|
|
||||||
|
|
||||||
m3u8 = get_html(m3u8_url)
|
m3u8 = get_html(m3u8_url)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user