Skip to content

Commit

Permalink
Merge pull request #4 from WwwwwyDev/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
WwwwwyDev committed May 7, 2024
2 parents cea61c3 + 566e7f6 commit 60d7faa
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion crawlist/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
4 changes: 2 additions & 2 deletions crawlist/analyzers/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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'])
Expand Down
11 changes: 7 additions & 4 deletions crawlist/analyzers/pager/dynamic_pager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
EMAIL = '[email protected]'
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'
Expand Down

0 comments on commit 60d7faa

Please sign in to comment.