Compare commits

...

3 Commits

Author SHA1 Message Date
pukkandan
079a7cfc71
[downloader] Do not use aria2c for non-native m3u8
Closes #2718
2022-02-11 12:09:03 +05:30
pukkandan
3856407a86
[options] Rename --clean-infojson to --clean-info-json 2022-02-11 12:07:10 +05:30
pukkandan
db2e129ca0
[options] Better ambiguous option resolution
Eg: `--write-auto` no longer results in
> ambiguous option: --write-auto (--write-auto-subs, --write-automatic-subs?)
2022-02-11 12:07:03 +05:30
6 changed files with 22 additions and 8 deletions

View File

@ -1895,11 +1895,13 @@ These options are not intended to be used by the end-user
These are aliases that are no longer documented for various reasons These are aliases that are no longer documented for various reasons
--avconv-location --ffmpeg-location --avconv-location --ffmpeg-location
--clean-infojson --clean-info-json
--cn-verification-proxy URL --geo-verification-proxy URL --cn-verification-proxy URL --geo-verification-proxy URL
--dump-headers --print-traffic --dump-headers --print-traffic
--dump-intermediate-pages --dump-pages --dump-intermediate-pages --dump-pages
--force-write-download-archive --force-write-archive --force-write-download-archive --force-write-archive
--load-info --load-info-json --load-info --load-info-json
--no-clean-infojson --no-clean-info-json
--no-split-tracks --no-split-chapters --no-split-tracks --no-split-chapters
--no-write-srt --no-write-subs --no-write-srt --no-write-subs
--prefer-unsecure --prefer-insecure --prefer-unsecure --prefer-insecure

View File

@ -117,7 +117,7 @@ def _get_suitable_downloader(info_dict, protocol, params, default):
return FFmpegFD return FFmpegFD
elif (external_downloader or '').lower() == 'native': elif (external_downloader or '').lower() == 'native':
return HlsFD return HlsFD
elif get_suitable_downloader( elif protocol == 'm3u8_native' and get_suitable_downloader(
info_dict, params, None, protocol='m3u8_frag_urls', to_stdout=info_dict['to_stdout']): info_dict, params, None, protocol='m3u8_frag_urls', to_stdout=info_dict['to_stdout']):
return HlsFD return HlsFD
elif params.get('hls_prefer_native') is True: elif params.get('hls_prefer_native') is True:

View File

@ -3108,7 +3108,7 @@ class InfoExtractor(object):
}) })
return formats, subtitles return formats, subtitles
def _parse_html5_media_entries(self, base_url, webpage, video_id, m3u8_id=None, m3u8_entry_protocol='m3u8', mpd_id=None, preference=None, quality=None): def _parse_html5_media_entries(self, base_url, webpage, video_id, m3u8_id=None, m3u8_entry_protocol='m3u8_native', mpd_id=None, preference=None, quality=None):
def absolute_url(item_url): def absolute_url(item_url):
return urljoin(base_url, item_url) return urljoin(base_url, item_url)

View File

@ -42,8 +42,7 @@ class OpenRecBaseIE(InfoExtractor):
if not m3u8_url: if not m3u8_url:
continue continue
formats.extend(self._extract_m3u8_formats( formats.extend(self._extract_m3u8_formats(
m3u8_url, video_id, ext='mp4', entry_protocol='m3u8', m3u8_url, video_id, ext='mp4', live=is_live, m3u8_id='hls-%s' % name))
m3u8_id='hls-%s' % name, live=True))
self._sort_formats(formats) self._sort_formats(formats)

View File

@ -688,7 +688,7 @@ class VKWallPostIE(VKBaseIE):
'artist': performer, 'artist': performer,
'track': title, 'track': title,
'ext': 'mp4', 'ext': 'mp4',
'protocol': 'm3u8', 'protocol': 'm3u8_native',
}) })
for video in re.finditer( for video in re.finditer(

View File

@ -117,6 +117,19 @@ def parseOpts(overrideArguments=None, ignore_config_files='if_override'):
return parser, opts, args return parser, opts, args
class _YoutubeDLOptionParser(optparse.OptionParser):
# optparse is deprecated since python 3.2. So assume a stable interface even for private methods
def _match_long_opt(self, opt):
"""Improve ambigious argument resolution by comparing option objects instead of argument strings"""
try:
return super()._match_long_opt(opt)
except optparse.AmbiguousOptionError as e:
if len(set(self._long_opt[p] for p in e.possibilities)) == 1:
return e.possibilities[0]
raise
def create_parser(): def create_parser():
def _format_option_string(option): def _format_option_string(option):
''' ('-o', '--option') -> -o, --format METAVAR''' ''' ('-o', '--option') -> -o, --format METAVAR'''
@ -215,7 +228,7 @@ def create_parser():
'conflict_handler': 'resolve', 'conflict_handler': 'resolve',
} }
parser = optparse.OptionParser(**compat_kwargs(kw)) parser = _YoutubeDLOptionParser(**compat_kwargs(kw))
general = optparse.OptionGroup(parser, 'General Options') general = optparse.OptionGroup(parser, 'General Options')
general.add_option( general.add_option(
@ -1195,13 +1208,13 @@ def create_parser():
action='store_false', dest='allow_playlist_files', action='store_false', dest='allow_playlist_files',
help='Do not write playlist metadata when using --write-info-json, --write-description etc.') help='Do not write playlist metadata when using --write-info-json, --write-description etc.')
filesystem.add_option( filesystem.add_option(
'--clean-infojson', '--clean-info-json', '--clean-infojson',
action='store_true', dest='clean_infojson', default=None, action='store_true', dest='clean_infojson', default=None,
help=( help=(
'Remove some private fields such as filenames from the infojson. ' 'Remove some private fields such as filenames from the infojson. '
'Note that it could still contain some personal information (default)')) 'Note that it could still contain some personal information (default)'))
filesystem.add_option( filesystem.add_option(
'--no-clean-infojson', '--no-clean-info-json', '--no-clean-infojson',
action='store_false', dest='clean_infojson', action='store_false', dest='clean_infojson',
help='Write all fields to the infojson') help='Write all fields to the infojson')
filesystem.add_option( filesystem.add_option(