aboutsummaryrefslogtreecommitdiffstats
path: root/youtube_dl
diff options
context:
space:
mode:
authorTithen-Firion <tithen.firion.0@gmail.com>2017-04-29 12:41:42 +0200
committerTithen-Firion <tithen.firion.0@gmail.com>2017-04-29 12:41:42 +0200
commit98f9d873814da2a8584cc30c0e197c15ed249db3 (patch)
tree1a1f62a87b0cf87a32ddd5e4a34956756b75fef9 /youtube_dl
parentfcace2d1adac5d1f306b22219fde3a4542bcd719 (diff)
downloadyoutube-dl-98f9d873814da2a8584cc30c0e197c15ed249db3.zip
youtube-dl-98f9d873814da2a8584cc30c0e197c15ed249db3.tar.gz
youtube-dl-98f9d873814da2a8584cc30c0e197c15ed249db3.tar.bz2
[phantomjs] Add required version checking
Diffstat (limited to 'youtube_dl')
-rw-r--r--youtube_dl/utils.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index 9c94b7e..84aaac6 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -3734,13 +3734,22 @@ class PhantomJSwrapper(object):
_TMP_FILE_NAMES = ['script', 'html', 'cookies']
- def __init__(self, extractor, timeout=10000):
+ def __init__(self, extractor, required_version=None, timeout=10000):
self.exe = check_executable('phantomjs', ['-v'])
if not self.exe:
raise ExtractorError('PhantomJS executable not found in PATH, '
'download it from http://phantomjs.org',
expected=True)
+
self.extractor = extractor
+
+ if required_version:
+ version = get_exe_version(self.exe, version_re=r'([0-9.]+)')
+ if is_outdated_version(version, required_version):
+ self.extractor._downloader.report_warning(
+ 'Your copy of PhantomJS is outdated, update it to version '
+ '%s or newer if you encounter any errors.' % required_version)
+
self.options = {
'timeout': timeout,
}