mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-10-03 12:03:46 -04:00
Change defaults
* Enabled --ignore by default * Disabled --video-multistreams and --audio-multistreams by default * Changed default format selection to 'bv*+ba/b' when --audio-multistreams is disabled * Changed default format sort order to 'res,fps,codec,size,br,asr,proto,ext,has_audio,source,format_id' * Changed default output template to '%(title)s [%(id)s].%(ext)s' * Enabled `--list-formats-as-table` by default
This commit is contained in:
@@ -178,7 +178,7 @@ class YoutubeDL(object):
|
||||
outtmpl: Template for output names.
|
||||
restrictfilenames: Do not allow "&" and spaces in file names.
|
||||
trim_file_name: Limit length of filename (extension excluded).
|
||||
ignoreerrors: Do not stop on download errors.
|
||||
ignoreerrors: Do not stop on download errors. (Default False when running youtube-dlc, but True when directly accessing YoutubeDL class)
|
||||
force_generic_extractor: Force downloader to use the generic extractor
|
||||
nooverwrites: Prevent overwriting files.
|
||||
playliststart: Playlist item to start at.
|
||||
@@ -1185,23 +1185,20 @@ class YoutubeDL(object):
|
||||
merger = FFmpegMergerPP(self)
|
||||
return merger.available and merger.can_merge()
|
||||
|
||||
def prefer_best():
|
||||
if self.params.get('simulate', False):
|
||||
return False
|
||||
if not download:
|
||||
return False
|
||||
if self.params.get('outtmpl', DEFAULT_OUTTMPL) == '-':
|
||||
return True
|
||||
if info_dict.get('is_live'):
|
||||
return True
|
||||
if not can_merge():
|
||||
return True
|
||||
return False
|
||||
prefer_best = (
|
||||
not self.params.get('simulate', False)
|
||||
and download
|
||||
and (
|
||||
not can_merge()
|
||||
or info_dict.get('is_live')
|
||||
or self.params.get('outtmpl', DEFAULT_OUTTMPL) == '-'))
|
||||
|
||||
req_format_list = ['bestvideo+bestaudio', 'best']
|
||||
if prefer_best():
|
||||
req_format_list.reverse()
|
||||
return '/'.join(req_format_list)
|
||||
return (
|
||||
'best/bestvideo+bestaudio'
|
||||
if prefer_best
|
||||
else 'bestvideo*+bestaudio/best'
|
||||
if self.params.get('allow_multiple_audio_streams', False)
|
||||
else 'bestvideo+bestaudio/best')
|
||||
|
||||
def build_format_selector(self, format_spec):
|
||||
def syntax_error(note, start):
|
||||
@@ -1216,8 +1213,8 @@ class YoutubeDL(object):
|
||||
GROUP = 'GROUP'
|
||||
FormatSelector = collections.namedtuple('FormatSelector', ['type', 'selector', 'filters'])
|
||||
|
||||
allow_multiple_streams = {'audio': self.params.get('allow_multiple_audio_streams', True),
|
||||
'video': self.params.get('allow_multiple_video_streams', True)}
|
||||
allow_multiple_streams = {'audio': self.params.get('allow_multiple_audio_streams', False),
|
||||
'video': self.params.get('allow_multiple_video_streams', False)}
|
||||
|
||||
def _parse_filter(tokens):
|
||||
filter_parts = []
|
||||
|
@@ -1367,8 +1367,8 @@ class InfoExtractor(object):
|
||||
regex = r' *((?P<reverse>\+)?(?P<field>[a-zA-Z0-9_]+)((?P<seperator>[~:])(?P<limit>.*?))?)? *$'
|
||||
|
||||
default = ('hidden', 'has_video', 'extractor', 'lang', 'quality',
|
||||
'tbr', 'filesize', 'vbr', 'height', 'width', 'protocol', 'vext',
|
||||
'abr', 'aext', 'fps', 'filesize_approx', 'source_preference', 'format_id')
|
||||
'res', 'fps', 'codec', 'size', 'br', 'asr',
|
||||
'proto', 'ext', 'has_audio', 'source', 'format_id')
|
||||
|
||||
settings = {
|
||||
'vcodec': {'type': 'ordered', 'regex': True,
|
||||
@@ -1378,7 +1378,7 @@ class InfoExtractor(object):
|
||||
'protocol': {'type': 'ordered', 'regex': True,
|
||||
'order': ['(ht|f)tps', '(ht|f)tp$', 'm3u8.+', 'm3u8', '.*dash', '', 'mms|rtsp', 'none', 'f4']},
|
||||
'vext': {'type': 'ordered', 'field': 'video_ext',
|
||||
'order': ('mp4', 'flv', 'webm', '', 'none'), # Why is flv prefered over webm???
|
||||
'order': ('mp4', 'webm', 'flv', '', 'none'),
|
||||
'order_free': ('webm', 'mp4', 'flv', '', 'none')},
|
||||
'aext': {'type': 'ordered', 'field': 'audio_ext',
|
||||
'order': ('m4a', 'aac', 'mp3', 'ogg', 'opus', 'webm', '', 'none'),
|
||||
@@ -1386,7 +1386,7 @@ class InfoExtractor(object):
|
||||
'hidden': {'visible': False, 'forced': True, 'type': 'extractor', 'max': -1000},
|
||||
'extractor_preference': {'priority': True, 'type': 'extractor'},
|
||||
'has_video': {'priority': True, 'field': 'vcodec', 'type': 'boolean', 'not_in_list': ('none',)},
|
||||
'has_audio': {'priority': False, 'field': 'acodec', 'type': 'boolean', 'not_in_list': ('none',)},
|
||||
'has_audio': {'field': 'acodec', 'type': 'boolean', 'not_in_list': ('none',)},
|
||||
'language_preference': {'priority': True, 'convert': 'ignore'},
|
||||
'quality': {'priority': True, 'convert': 'float_none'},
|
||||
'filesize': {'convert': 'bytes'},
|
||||
|
@@ -143,12 +143,12 @@ def parseOpts(overrideArguments=None):
|
||||
help='Update this program to latest version. Make sure that you have sufficient permissions (run with sudo if needed)')
|
||||
general.add_option(
|
||||
'-i', '--ignore-errors', '--no-abort-on-error',
|
||||
action='store_true', dest='ignoreerrors', default=False,
|
||||
help='Continue on download errors, for example to skip unavailable videos in a playlist')
|
||||
action='store_true', dest='ignoreerrors', default=True,
|
||||
help='Continue on download errors, for example to skip unavailable videos in a playlist (default)')
|
||||
general.add_option(
|
||||
'--abort-on-error', '--no-ignore-errors',
|
||||
action='store_false', dest='ignoreerrors',
|
||||
help='Abort downloading of further videos if an error occurs (default)')
|
||||
help='Abort downloading of further videos if an error occurs')
|
||||
general.add_option(
|
||||
'--dump-user-agent',
|
||||
action='store_true', dest='dump_user_agent', default=False,
|
||||
@@ -438,20 +438,20 @@ def parseOpts(overrideArguments=None):
|
||||
'see "Sorting Formats" for more details'))
|
||||
video_format.add_option(
|
||||
'--video-multistreams',
|
||||
action='store_true', dest='allow_multiple_video_streams', default=True,
|
||||
help='Allow multiple video streams to be merged into a single file (default)')
|
||||
action='store_true', dest='allow_multiple_video_streams', default=False,
|
||||
help='Allow multiple video streams to be merged into a single file')
|
||||
video_format.add_option(
|
||||
'--no-video-multistreams',
|
||||
action='store_false', dest='allow_multiple_video_streams',
|
||||
help='Only one video stream is downloaded for each output file')
|
||||
help='Only one video stream is downloaded for each output file (default)')
|
||||
video_format.add_option(
|
||||
'--audio-multistreams',
|
||||
action='store_true', dest='allow_multiple_audio_streams', default=True,
|
||||
help='Allow multiple audio streams to be merged into a single file (default)')
|
||||
action='store_true', dest='allow_multiple_audio_streams', default=False,
|
||||
help='Allow multiple audio streams to be merged into a single file')
|
||||
video_format.add_option(
|
||||
'--no-audio-multistreams',
|
||||
action='store_false', dest='allow_multiple_audio_streams',
|
||||
help='Only one audio stream is downloaded for each output file')
|
||||
help='Only one audio stream is downloaded for each output file (default)')
|
||||
video_format.add_option(
|
||||
'--all-formats',
|
||||
action='store_const', dest='format', const='all',
|
||||
@@ -466,8 +466,8 @@ def parseOpts(overrideArguments=None):
|
||||
help='List all available formats of requested videos')
|
||||
video_format.add_option(
|
||||
'--list-formats-as-table',
|
||||
action='store_true', dest='listformats_table', default=False,
|
||||
help='Present the output of -F in a more tabular form')
|
||||
action='store_true', dest='listformats_table', default=True,
|
||||
help='Present the output of -F in a more tabular form (default)')
|
||||
video_format.add_option(
|
||||
'--list-formats-old', '--no-list-formats-as-table',
|
||||
action='store_false', dest='listformats_table',
|
||||
|
@@ -4128,7 +4128,7 @@ def qualities(quality_ids):
|
||||
return q
|
||||
|
||||
|
||||
DEFAULT_OUTTMPL = '%(title)s-%(id)s.%(ext)s'
|
||||
DEFAULT_OUTTMPL = '%(title)s [%(id)s].%(ext)s'
|
||||
|
||||
|
||||
def limit_length(s, length):
|
||||
|
Reference in New Issue
Block a user