-#!/usr/bin/env python
+#!/usr/bin/env python3
# coding: utf-8
from __future__ import unicode_literals
DateRange,
decodeOption,
DownloadError,
+ error_to_compat_str,
ExistingVideoReached,
expand_path,
match_filter_func,
std_headers,
write_string,
)
-from .update import update_self
+from .update import run_update
from .downloader import (
FileDownloader,
)
if numeric_limit is None:
parser.error('invalid rate limit specified')
opts.ratelimit = numeric_limit
+ if opts.throttledratelimit is not None:
+ numeric_limit = FileDownloader.parse_bytes(opts.throttledratelimit)
+ if numeric_limit is None:
+ parser.error('invalid rate limit specified')
+ opts.throttledratelimit = numeric_limit
if opts.min_filesize is not None:
numeric_limit = FileDownloader.parse_bytes(opts.min_filesize)
if numeric_limit is None:
return parsed_compat_opts
all_compat_opts = [
- 'filename', 'format-sort', 'abort-on-error', 'format-spec', 'multistreams',
- 'no-playlist-metafiles', 'no-live-chat', 'playlist-index', 'list-formats',
+ 'filename', 'format-sort', 'abort-on-error', 'format-spec', 'no-playlist-metafiles',
+ 'multistreams', 'no-live-chat', 'playlist-index', 'list-formats', 'no-direct-merge',
'no-youtube-channel-redirect', 'no-youtube-unavailable-videos', 'no-attach-info-json',
+ 'embed-thumbnail-atomicparsley', 'seperate-video-versions',
]
compat_opts = parse_compat_opts()
else:
_unused_compat_opt('filename')
+ def validate_outtmpl(tmpl, msg):
+ err = YoutubeDL.validate_outtmpl(tmpl)
+ if err:
+ parser.error('invalid %s %r: %s' % (msg, tmpl, error_to_compat_str(err)))
+
+ for k, tmpl in opts.outtmpl.items():
+ validate_outtmpl(tmpl, '%s output template' % k)
+ for tmpl in opts.forceprint:
+ validate_outtmpl(tmpl, 'print template')
+
if opts.extractaudio and not opts.keepvideo and opts.format is None:
opts.format = 'bestaudio/best'
'ignoreerrors': opts.ignoreerrors,
'force_generic_extractor': opts.force_generic_extractor,
'ratelimit': opts.ratelimit,
+ 'throttledratelimit': opts.throttledratelimit,
'overwrites': opts.overwrites,
'retries': opts.retries,
'fragment_retries': opts.fragment_retries,
'include_ads': opts.include_ads,
'default_search': opts.default_search,
'dynamic_mpd': opts.dynamic_mpd,
+ 'extractor_args': opts.extractor_args,
'youtube_include_dash_manifest': opts.youtube_include_dash_manifest,
'youtube_include_hls_manifest': opts.youtube_include_hls_manifest,
'encoding': opts.encoding,
# Update version
if opts.update_self:
# If updater returns True, exit. Required for windows
- if update_self(ydl.to_screen, opts.verbose, ydl._opener):
+ if run_update(ydl):
if actual_use:
sys.exit('ERROR: The program must exit for the update to complete')
sys.exit()