diff --git a/DrissionPage/configs/chromium_options.py b/DrissionPage/configs/chromium_options.py index 7a6b0f5..6f32d90 100644 --- a/DrissionPage/configs/chromium_options.py +++ b/DrissionPage/configs/chromium_options.py @@ -146,8 +146,11 @@ class ChromiumOptions(object): """ self.remove_argument(arg) if value is not False: - arg_str = arg if value is None else f'{arg}={value}' - self._arguments.append(arg_str) + if arg == '--headless' and value is None: + self._arguments.append('--headless=new') + else: + arg_str = arg if value is None else f'{arg}={value}' + self._arguments.append(arg_str) return self def remove_argument(self, value): diff --git a/DrissionPage/session_page.py b/DrissionPage/session_page.py index 738d9a4..7e07aa7 100644 --- a/DrissionPage/session_page.py +++ b/DrissionPage/session_page.py @@ -316,7 +316,7 @@ def set_charset(response): content_type = response.headers.get('content-type', '').lower() if not content_type.endswith(';'): content_type += ';' - charset = search(r'charset[=: ]*(.*)?;', content_type) + charset = search(r'charset[=: ]*(.*)?;?', content_type) if charset: response.encoding = charset.group(1)