diff --git a/DrissionPage/_functions/browser.py b/DrissionPage/_functions/browser.py index 33f0df6..99e1211 100644 --- a/DrissionPage/_functions/browser.py +++ b/DrissionPage/_functions/browser.py @@ -87,7 +87,8 @@ def get_launch_args(opt): if not has_user_path and not opt.system_user_path: port = opt.address.split(':')[-1] if opt.address else '0' - path = Path(gettempdir()) / 'DrissionPage' / f'userData_{port}' + p = Path(opt.tmp_path) if opt.tmp_path else Path(gettempdir()) / 'DrissionPage' + path = p / f'userData_{port}' path.mkdir(parents=True, exist_ok=True) opt.set_user_data_path(path) result.add(f'--user-data-dir={path}') diff --git a/DrissionPage/_pages/chromium_base.py b/DrissionPage/_pages/chromium_base.py index 87d0c70..3b66a76 100644 --- a/DrissionPage/_pages/chromium_base.py +++ b/DrissionPage/_pages/chromium_base.py @@ -6,7 +6,7 @@ from json import loads, JSONDecodeError from os.path import sep from pathlib import Path -from re import findall, match +from re import findall from threading import Thread from time import perf_counter, sleep from urllib.parse import quote @@ -894,13 +894,7 @@ class ChromiumBase(BasePage): :param interval: 重试间隔 :return: 重试次数和间隔组成的tuple """ - url = quote(url, safe='-_.~!*\'"();:@&=+$,/\\?#[]%') - if not url: - self._url = 'chrome://newtab/' - elif not match(r'.*?://', url): - self._url = f'http://{url}' - else: - self._url = url + self._url = quote(url, safe='-_.~!*\'"();:@&=+$,/\\?#[]%') or 'chrome://newtab/' retry = retry if retry is not None else self.retry_times interval = interval if interval is not None else self.retry_interval return retry, interval