Merge branch 'patch-2' of https://github.com/wwqgtxx/you-get into wwqgtxx-patch-2

This commit is contained in:
Mort Yao 2017-07-22 10:59:12 +02:00
commit b487baa256
No known key found for this signature in database
GPG Key ID: 07DA00CB78203251
2 changed files with 9 additions and 3 deletions

View File

@ -1215,10 +1215,11 @@ def script_main(script_name, download, download_playlist, **kwargs):
-t | --timeout <SECONDS> Set socket timeout.
-d | --debug Show traceback and other debug info.
-I | --input-file Read non-playlist urls from file.
-P | --password <PASSWORD> Set video visit password to PASSWORD.
'''
short_opts = 'Vhfiuc:ndF:O:o:p:x:y:s:t:I:'
opts = ['version', 'help', 'force', 'info', 'url', 'cookies', 'no-caption', 'no-merge', 'no-proxy', 'debug', 'json', 'format=', 'stream=', 'itag=', 'output-filename=', 'output-dir=', 'player=', 'http-proxy=', 'socks-proxy=', 'extractor-proxy=', 'lang=', 'timeout=', 'input-file=']
short_opts = 'Vhfiuc:ndF:O:o:p:x:y:s:t:I:P:'
opts = ['version', 'help', 'force', 'info', 'url', 'cookies', 'no-caption', 'no-merge', 'no-proxy', 'debug', 'json', 'format=', 'stream=', 'itag=', 'output-filename=', 'output-dir=', 'player=', 'http-proxy=', 'socks-proxy=', 'extractor-proxy=', 'lang=', 'timeout=', 'input-file=', 'password=']
#dead code? download_playlist is a function and always True
#if download_playlist:
short_opts = 'l' + short_opts
@ -1252,6 +1253,7 @@ def script_main(script_name, download, download_playlist, **kwargs):
traceback = False
timeout = 600
urls_from_file = []
password = None
for o, a in opts:
if o in ('-V', '--version'):
@ -1330,6 +1332,8 @@ def script_main(script_name, download, download_playlist, **kwargs):
lang = a
elif o in ('-t', '--timeout'):
timeout = int(a)
elif o in ('-P', '--password',):
password = a
elif o in ('-I', '--input-file'):
logging.debug('you are trying to load urls from {}'.format(a))
if playlist:

View File

@ -196,7 +196,9 @@ class Youku(VideoExtractor):
if data.get('error'):
if data['error']['code'] == -2002:
self.password_protected = True
self.password = input(log.sprint('Password: ', log.YELLOW))
self.password = kwargs.get("password", None)
if not self.password:
self.password = input(log.sprint('Password: ', log.YELLOW))
data = youku_ups(self.vid, password=self.password)['data']
if data.get('error'):
log.wtf(data['error']['note'])