[openload] New --phantomjs-location option
This option allows users to use a phantomjs binary that is not in PATH Closes #15146
This commit is contained in:
parent
9d6458a206
commit
6bc637d34a
@ -2246,7 +2246,7 @@ class YoutubeDL(object):
|
|||||||
|
|
||||||
exe_versions = FFmpegPostProcessor.get_versions(self)
|
exe_versions = FFmpegPostProcessor.get_versions(self)
|
||||||
exe_versions['rtmpdump'] = rtmpdump_version()
|
exe_versions['rtmpdump'] = rtmpdump_version()
|
||||||
exe_versions['phantomjs'] = PhantomJSwrapper._version()
|
exe_versions['phantomjs'] = PhantomJSwrapper._version(self)
|
||||||
exe_str = ', '.join(
|
exe_str = ', '.join(
|
||||||
'%s %s' % (exe, v)
|
'%s %s' % (exe, v)
|
||||||
for exe, v in sorted(exe_versions.items())
|
for exe, v in sorted(exe_versions.items())
|
||||||
|
@ -415,6 +415,7 @@ def _real_main(argv=None):
|
|||||||
'match_filter': match_filter,
|
'match_filter': match_filter,
|
||||||
'no_color': opts.no_color,
|
'no_color': opts.no_color,
|
||||||
'ffmpeg_location': opts.ffmpeg_location,
|
'ffmpeg_location': opts.ffmpeg_location,
|
||||||
|
'phantomjs_location': opts.phantomjs_location,
|
||||||
'hls_prefer_native': opts.hls_prefer_native,
|
'hls_prefer_native': opts.hls_prefer_native,
|
||||||
'hls_use_mpegts': opts.hls_use_mpegts,
|
'hls_use_mpegts': opts.hls_use_mpegts,
|
||||||
'external_downloader_args': external_downloader_args,
|
'external_downloader_args': external_downloader_args,
|
||||||
|
@ -108,13 +108,18 @@ class PhantomJSwrapper(object):
|
|||||||
_TMP_FILE_NAMES = ['script', 'html', 'cookies']
|
_TMP_FILE_NAMES = ['script', 'html', 'cookies']
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _version():
|
def _get_path(downloader):
|
||||||
return get_exe_version('phantomjs', version_re=r'([0-9.]+)')
|
location = downloader.params.get('phantomjs_location') or 'phantomjs'
|
||||||
|
return location
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _version(downloader):
|
||||||
|
return get_exe_version(PhantomJSwrapper._get_path(downloader), version_re=r'([0-9.]+)')
|
||||||
|
|
||||||
def __init__(self, extractor, required_version=None, timeout=10000):
|
def __init__(self, extractor, required_version=None, timeout=10000):
|
||||||
self._TMP_FILES = {}
|
self._TMP_FILES = {}
|
||||||
|
|
||||||
self.exe = check_executable('phantomjs', ['-v'])
|
self.exe = check_executable(self._get_path(extractor._downloader), ['-v'])
|
||||||
if not self.exe:
|
if not self.exe:
|
||||||
raise ExtractorError('PhantomJS executable not found in PATH, '
|
raise ExtractorError('PhantomJS executable not found in PATH, '
|
||||||
'download it from http://phantomjs.org',
|
'download it from http://phantomjs.org',
|
||||||
@ -123,7 +128,7 @@ class PhantomJSwrapper(object):
|
|||||||
self.extractor = extractor
|
self.extractor = extractor
|
||||||
|
|
||||||
if required_version:
|
if required_version:
|
||||||
version = self._version()
|
version = self._version(self.extractor._downloader)
|
||||||
if is_outdated_version(version, required_version):
|
if is_outdated_version(version, required_version):
|
||||||
self.extractor._downloader.report_warning(
|
self.extractor._downloader.report_warning(
|
||||||
'Your copy of PhantomJS is outdated, update it to version '
|
'Your copy of PhantomJS is outdated, update it to version '
|
||||||
|
@ -516,6 +516,10 @@ def parseOpts(overrideArguments=None):
|
|||||||
'--external-downloader-args',
|
'--external-downloader-args',
|
||||||
dest='external_downloader_args', metavar='ARGS',
|
dest='external_downloader_args', metavar='ARGS',
|
||||||
help='Give these arguments to the external downloader')
|
help='Give these arguments to the external downloader')
|
||||||
|
downloader.add_option(
|
||||||
|
'--phantomjs-location', metavar='PATH',
|
||||||
|
dest='phantomjs_location',
|
||||||
|
help='Path to the phantomjs binary')
|
||||||
|
|
||||||
workarounds = optparse.OptionGroup(parser, 'Workarounds')
|
workarounds = optparse.OptionGroup(parser, 'Workarounds')
|
||||||
workarounds.add_option(
|
workarounds.add_option(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user