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
--avconv-location --ffmpeg-location
--clean-infojson --clean-info-json
--cn-verification-proxy URL --geo-verification-proxy URL
--dump-headers --print-traffic
--dump-intermediate-pages --dump-pages
--force-write-download-archive --force-write-archive
--load-info --load-info-json
--no-clean-infojson --no-clean-info-json
--no-split-tracks --no-split-chapters
--no-write-srt --no-write-subs
--prefer-unsecure --prefer-insecure

View File

@ -117,7 +117,7 @@ def _get_suitable_downloader(info_dict, protocol, params, default):
return FFmpegFD
elif (external_downloader or '').lower() == 'native':
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']):
return HlsFD
elif params.get('hls_prefer_native') is True:

View File

@ -3108,7 +3108,7 @@ class InfoExtractor(object):
})
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):
return urljoin(base_url, item_url)

View File

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

View File

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

View File

@ -117,6 +117,19 @@ def parseOpts(overrideArguments=None, ignore_config_files='if_override'):
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 _format_option_string(option):
''' ('-o', '--option') -> -o, --format METAVAR'''
@ -215,7 +228,7 @@ def create_parser():
'conflict_handler': 'resolve',
}
parser = optparse.OptionParser(**compat_kwargs(kw))
parser = _YoutubeDLOptionParser(**compat_kwargs(kw))
general = optparse.OptionGroup(parser, 'General Options')
general.add_option(
@ -1195,13 +1208,13 @@ def create_parser():
action='store_false', dest='allow_playlist_files',
help='Do not write playlist metadata when using --write-info-json, --write-description etc.')
filesystem.add_option(
'--clean-infojson',
'--clean-info-json', '--clean-infojson',
action='store_true', dest='clean_infojson', default=None,
help=(
'Remove some private fields such as filenames from the infojson. '
'Note that it could still contain some personal information (default)'))
filesystem.add_option(
'--no-clean-infojson',
'--no-clean-info-json', '--no-clean-infojson',
action='store_false', dest='clean_infojson',
help='Write all fields to the infojson')
filesystem.add_option(