aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/extractor/openload.py
diff options
context:
space:
mode:
Diffstat (limited to 'yt_dlp/extractor/openload.py')
-rw-r--r--yt_dlp/extractor/openload.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/yt_dlp/extractor/openload.py b/yt_dlp/extractor/openload.py
index e66ed4831..4bba7bdd0 100644
--- a/yt_dlp/extractor/openload.py
+++ b/yt_dlp/extractor/openload.py
@@ -219,7 +219,7 @@ class PhantomJSwrapper:
return html, stdout
- def execute(self, jscode, video_id=None, note='Executing JS'):
+ def execute(self, jscode, video_id=None, *, note='Executing JS'):
"""Execute JS and return stdout"""
if 'phantom.exit();' not in jscode:
jscode += ';\nphantom.exit();'
@@ -231,8 +231,12 @@ class PhantomJSwrapper:
cmd = [self.exe, '--ssl-protocol=any', self._TMP_FILES['script'].name]
self.extractor.write_debug(f'PhantomJS command line: {shell_quote(cmd)}')
- stdout, stderr, returncode = Popen.run(cmd, text=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ try:
+ stdout, stderr, returncode = Popen.run(cmd, timeout=self.options['timeout'] / 1000,
+ text=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ except Exception as e:
+ raise ExtractorError(f'{note} failed: Unable to run PhantomJS binary', cause=e)
if returncode:
- raise ExtractorError(f'Executing JS failed:\n{stderr.strip()}')
+ raise ExtractorError(f'{note} failed:\n{stderr.strip()}')
return stdout