From 44a5a5ed7ea8f18c6a638ced98fb6e78626aa863 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=B5=E3=81=81?= Date: Fri, 17 Mar 2023 19:30:14 +0900 Subject: [PATCH] add explicitly specify --headless=new MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ふぁ --- archivebox/util.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/archivebox/util.py b/archivebox/util.py index fe6850ea..a0fba9ba 100644 --- a/archivebox/util.py +++ b/archivebox/util.py @@ -219,7 +219,7 @@ def get_headers(url: str, timeout: int=None) -> str: def chrome_args(**options) -> List[str]: """helper to build up a chrome shell command with arguments""" - from .config import CHROME_OPTIONS + from .config import CHROME_OPTIONS, CHROME_VERSION options = {**CHROME_OPTIONS, **options} @@ -229,7 +229,10 @@ def chrome_args(**options) -> List[str]: cmd_args = [options['CHROME_BINARY']] if options['CHROME_HEADLESS']: - cmd_args += ('--headless',) + if int(CHROME_VERSION.split()[1].split('.')[0]) >= 111: + cmd_args += ("--headless=new",) + else: + cmd_args += ('--headless',) if not options['CHROME_SANDBOX']: # assume this means we are running inside a docker container