diff --git a/src/you_get/common.py b/src/you_get/common.py index 64c791f2..4e8e168f 100755 --- a/src/you_get/common.py +++ b/src/you_get/common.py @@ -1215,10 +1215,11 @@ def script_main(script_name, download, download_playlist, **kwargs): -t | --timeout Set socket timeout. -d | --debug Show traceback and other debug info. -I | --input-file Read non-playlist urls from file. + -P | --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: diff --git a/src/you_get/extractors/youku.py b/src/you_get/extractors/youku.py index c1db2de5..eebdb46f 100644 --- a/src/you_get/extractors/youku.py +++ b/src/you_get/extractors/youku.py @@ -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'])