diff --git a/crawlist/__version__.py b/crawlist/__version__.py index b911f68..e77aecd 100644 --- a/crawlist/__version__.py +++ b/crawlist/__version__.py @@ -3,6 +3,6 @@ # 88YbdP88 8P 88""" dP__Yb Yb 88"Yb dP__Yb Yb "88 88"" # 88 YY 88 dP 88 dP""""Yb YboodP 88 Yb dP""""Yb YboodP 888888 -VERSION = (0, 0, 7) +VERSION = (0, 0, 8) __version__ = '.'.join(map(str, VERSION)) diff --git a/crawlist/analyzers/driver.py b/crawlist/analyzers/driver.py index a5db371..4f29800 100644 --- a/crawlist/analyzers/driver.py +++ b/crawlist/analyzers/driver.py @@ -29,7 +29,7 @@ def get_driver(self) -> WebDriver: add_default_chrome_options(option) if not self.is_debug: option.add_argument("--headless") - if not self.is_eager: + if self.is_eager: option.page_load_strategy = 'eager' option.add_experimental_option('excludeSwitches', ['enable-automation']) webdriver = wd.Chrome(service=Service(ChromeDriverManager().install()), options=option) @@ -53,7 +53,7 @@ def get_driver(self) -> WebDriver: option = wd.ChromeOptions() add_default_chrome_options(option) option.add_argument("--headless") - if not self.is_eager: + if self.is_eager: option.page_load_strategy = 'eager' option.set_capability('cloud:options', DesiredCapabilities.CHROME) option.add_experimental_option('excludeSwitches', ['enable-automation']) diff --git a/crawlist/analyzers/pager/dynamic_pager.py b/crawlist/analyzers/pager/dynamic_pager.py index a7276cc..f7b1b3f 100644 --- a/crawlist/analyzers/pager/dynamic_pager.py +++ b/crawlist/analyzers/pager/dynamic_pager.py @@ -17,7 +17,9 @@ def __init__(self, webdriver: Driver | WebDriver = None, interval: float = 0.1) :param webdriver: WebDriver object for selenium :param interval: Grab the list frequency and adjust it according to the actual situation of the webpage """ + self.default_driver_flag = False if not webdriver: + self.default_driver_flag = True self.webdriver = DefaultDriver()() else: if isinstance(webdriver, WebDriver): @@ -44,10 +46,11 @@ def pre_load(self, webdriver: WebDriver) -> None: pass def __del__(self): - try: - self.webdriver.quit() - except: - pass + if self.default_driver_flag: + try: + self.webdriver.quit() + except: + pass class DynamicRedirectPager(DynamicPager): diff --git a/setup.py b/setup.py index d08681c..f093890 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ EMAIL = 'wwy20001014@foxmail.com' AUTHOR = 'WwyDev' REQUIRES_PYTHON = '>=3.10.0' -VERSION = '0.0.7' +VERSION = '0.0.8' # What packages are required for this module to be executed? REQUIRED = [ 'parsel', 'selenium>=4.0.0', 'cssselect', 'lxml', 'requests', 'webdriver-manager'