projects
/
youtube-dl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' into subtitles_rework
[youtube-dl]
/
youtube_dl
/
__init__.py
diff --git
a/youtube_dl/__init__.py
b/youtube_dl/__init__.py
index b33a18a26486473b528760879d5b7c25ded6ea69..0083f2e99cfbc7a4ec28924a75de851f24c75f2f 100644
(file)
--- a/
youtube_dl/__init__.py
+++ b/
youtube_dl/__init__.py
@@
-28,6
+28,7
@@
__authors__ = (
'Axel Noack',
'Albert Kim',
'Pierre Rudloff',
'Axel Noack',
'Albert Kim',
'Pierre Rudloff',
+ 'Huarong Huo',
)
__license__ = 'Public Domain'
)
__license__ = 'Public Domain'
@@
-100,6
+101,16
@@
def parseOpts(overrideArguments=None):
pass
return None
pass
return None
+ def _hide_login_info(opts):
+ opts = list(opts)
+ for private_opt in ['-p', '--password', '-u', '--username']:
+ try:
+ i = opts.index(private_opt)
+ opts[i+1] = '<PRIVATE>'
+ except ValueError:
+ pass
+ return opts
+
max_width = 80
max_help_position = 80
max_width = 80
max_help_position = 80
@@
-182,7
+193,7
@@
def parseOpts(overrideArguments=None):
video_format.add_option('-f', '--format',
action='store', dest='format', metavar='FORMAT',
video_format.add_option('-f', '--format',
action='store', dest='format', metavar='FORMAT',
- help='video format code, specifiy the order of preference using slashes: "-f 22/17/18"')
+ help='video format code, specifiy the order of preference using slashes: "-f 22/17/18"
. "-f mp4" and "-f flv" are also supported
')
video_format.add_option('--all-formats',
action='store_const', dest='format', help='download all available video formats', const='all')
video_format.add_option('--prefer-free-formats',
video_format.add_option('--all-formats',
action='store_const', dest='format', help='download all available video formats', const='all')
video_format.add_option('--prefer-free-formats',
@@
-194,13
+205,10
@@
def parseOpts(overrideArguments=None):
subtitles.add_option('--write-sub', '--write-srt',
action='store_true', dest='writesubtitles',
subtitles.add_option('--write-sub', '--write-srt',
action='store_true', dest='writesubtitles',
- help='write subtitle file
(currently youtube only)
', default=False)
+ help='write subtitle file', default=False)
subtitles.add_option('--write-auto-sub', '--write-automatic-sub',
action='store_true', dest='writeautomaticsub',
subtitles.add_option('--write-auto-sub', '--write-automatic-sub',
action='store_true', dest='writeautomaticsub',
- help='write automatic subtitle file (currently youtube only)', default=False)
- subtitles.add_option('--only-sub',
- action='store_true', dest='skip_download',
- help='[deprecated] alias of --skip-download', default=False)
+ help='write automatic subtitle file (youtube only)', default=False)
subtitles.add_option('--all-subs',
action='store_true', dest='allsubtitles',
help='downloads all the available subtitles of the video', default=False)
subtitles.add_option('--all-subs',
action='store_true', dest='allsubtitles',
help='downloads all the available subtitles of the video', default=False)
@@
-211,7
+219,7
@@
def parseOpts(overrideArguments=None):
action='store', dest='subtitlesformat', metavar='FORMAT',
help='subtitle format (default=srt) ([sbv/vtt] youtube only)', default='srt')
subtitles.add_option('--sub-lang', '--sub-langs', '--srt-lang',
action='store', dest='subtitlesformat', metavar='FORMAT',
help='subtitle format (default=srt) ([sbv/vtt] youtube only)', default='srt')
subtitles.add_option('--sub-lang', '--sub-langs', '--srt-lang',
- action='callback', dest='subtitleslang', metavar='LANGS', type='str',
+ action='callback', dest='subtitleslang
s
', metavar='LANGS', type='str',
default=[], callback=_comma_separated_values_options_callback,
help='languages of the subtitles to download (optional) separated by commas, use IETF language tags like \'en,pt\'')
default=[], callback=_comma_separated_values_options_callback,
help='languages of the subtitles to download (optional) separated by commas, use IETF language tags like \'en,pt\'')
@@
-358,9
+366,9
@@
def parseOpts(overrideArguments=None):
argv = systemConf + userConf + commandLineConf
opts, args = parser.parse_args(argv)
if opts.verbose:
argv = systemConf + userConf + commandLineConf
opts, args = parser.parse_args(argv)
if opts.verbose:
- sys.stderr.write(u'[debug] System config: ' + repr(
systemConf
) + '\n')
- sys.stderr.write(u'[debug] User config: ' + repr(
userConf
) + '\n')
- sys.stderr.write(u'[debug] Command-line args: ' + repr(
commandLineConf
) + '\n')
+ sys.stderr.write(u'[debug] System config: ' + repr(
_hide_login_info(systemConf)
) + '\n')
+ sys.stderr.write(u'[debug] User config: ' + repr(
_hide_login_info(userConf)
) + '\n')
+ sys.stderr.write(u'[debug] Command-line args: ' + repr(
_hide_login_info(commandLineConf)
) + '\n')
return parser, opts, args
return parser, opts, args
@@
-582,7
+590,7
@@
def _real_main(argv=None):
'allsubtitles': opts.allsubtitles,
'listsubtitles': opts.listsubtitles,
'subtitlesformat': opts.subtitlesformat,
'allsubtitles': opts.allsubtitles,
'listsubtitles': opts.listsubtitles,
'subtitlesformat': opts.subtitlesformat,
- 'subtitleslangs': opts.subtitleslang,
+ 'subtitleslangs': opts.subtitleslang
s
,
'matchtitle': decodeOption(opts.matchtitle),
'rejecttitle': decodeOption(opts.rejecttitle),
'max_downloads': opts.max_downloads,
'matchtitle': decodeOption(opts.matchtitle),
'rejecttitle': decodeOption(opts.rejecttitle),
'max_downloads': opts.max_downloads,