projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fcace2d
)
[phantomjs] Add required version checking
author
Tithen-Firion
<tithen.firion.0@gmail.com>
Sat, 29 Apr 2017 10:41:42 +0000
(12:41 +0200)
committer
Tithen-Firion
<tithen.firion.0@gmail.com>
Sat, 29 Apr 2017 10:41:42 +0000
(12:41 +0200)
youtube_dl/utils.py
patch
|
blob
|
history
diff --git
a/youtube_dl/utils.py
b/youtube_dl/utils.py
index 9c94b7ec9324d7ca215303dbe42fa69e3a8a18c7..84aaac6643a2a9df59bfbeee941ad33faf53eec8 100644
(file)
--- a/
youtube_dl/utils.py
+++ b/
youtube_dl/utils.py
@@
-3734,13
+3734,22
@@
class PhantomJSwrapper(object):
_TMP_FILE_NAMES = ['script', 'html', 'cookies']
_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.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
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,
}
self.options = {
'timeout': timeout,
}