[openload] Add option for phantomjs executable path
This commit is contained in:
parent
8476b4fd91
commit
f6fe7d6e17
@ -2259,7 +2259,9 @@ 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(
|
||||||
|
exe_path=self.params.get('phantomjs_location')
|
||||||
|
)
|
||||||
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())
|
||||||
|
@ -421,6 +421,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,
|
||||||
|
@ -107,14 +107,16 @@ class PhantomJSwrapper(object):
|
|||||||
|
|
||||||
_TMP_FILE_NAMES = ['script', 'html', 'cookies']
|
_TMP_FILE_NAMES = ['script', 'html', 'cookies']
|
||||||
|
|
||||||
@staticmethod
|
_DEFAULT_EXE_PATH = 'phantomjs'
|
||||||
def _version():
|
|
||||||
return get_exe_version('phantomjs', version_re=r'([0-9.]+)')
|
|
||||||
|
|
||||||
def __init__(self, extractor, required_version=None, timeout=10000):
|
@classmethod
|
||||||
|
def _version(cls, exe_path=None):
|
||||||
|
return get_exe_version(exe_path or cls._DEFAULT_EXE_PATH, version_re=r'([0-9.]+)')
|
||||||
|
|
||||||
|
def __init__(self, extractor, required_version=None, timeout=10000, exe_path=None):
|
||||||
self._TMP_FILES = {}
|
self._TMP_FILES = {}
|
||||||
|
|
||||||
self.exe = check_executable('phantomjs', ['-v'])
|
self.exe = check_executable(exe_path or self._DEFAULT_EXE_PATH, ['-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',
|
||||||
@ -342,7 +344,8 @@ class OpenloadIE(InfoExtractor):
|
|||||||
raise ExtractorError('File not found', expected=True, video_id=video_id)
|
raise ExtractorError('File not found', expected=True, video_id=video_id)
|
||||||
break
|
break
|
||||||
|
|
||||||
phantom = PhantomJSwrapper(self, required_version='2.0')
|
phantomjs_location = self._downloader.params.get('phantomjs_location')
|
||||||
|
phantom = PhantomJSwrapper(self, required_version='2.0', exe_path=phantomjs_location)
|
||||||
webpage, _ = phantom.get(page_url, html=webpage, video_id=video_id, headers=headers)
|
webpage, _ = phantom.get(page_url, html=webpage, video_id=video_id, headers=headers)
|
||||||
|
|
||||||
decoded_id = (get_element_by_id('streamurl', webpage) or
|
decoded_id = (get_element_by_id('streamurl', webpage) or
|
||||||
|
@ -850,6 +850,10 @@ def parseOpts(overrideArguments=None):
|
|||||||
'--ffmpeg-location', '--avconv-location', metavar='PATH',
|
'--ffmpeg-location', '--avconv-location', metavar='PATH',
|
||||||
dest='ffmpeg_location',
|
dest='ffmpeg_location',
|
||||||
help='Location of the ffmpeg/avconv binary; either the path to the binary or its containing directory.')
|
help='Location of the ffmpeg/avconv binary; either the path to the binary or its containing directory.')
|
||||||
|
postproc.add_option(
|
||||||
|
'--phantomjs-location', metavar='PATH',
|
||||||
|
dest='phantomjs_location',
|
||||||
|
help='Location of the phantomjs binary; either the path to the binary or its containing directory.')
|
||||||
postproc.add_option(
|
postproc.add_option(
|
||||||
'--exec',
|
'--exec',
|
||||||
metavar='CMD', dest='exec_cmd',
|
metavar='CMD', dest='exec_cmd',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user