Skip to content

Commit

Permalink
version0.0.8
Browse files Browse the repository at this point in the history
fix bug of auto close driver
  • Loading branch information
WwwwwyDev committed May 7, 2024
1 parent e819fb2 commit 566e7f6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 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))
15 changes: 11 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 @@ -43,6 +45,13 @@ def click_safety(self, button: WebElement) -> None:
def pre_load(self, webdriver: WebDriver) -> None:
pass

def __del__(self):
if self.default_driver_flag:
try:
self.webdriver.quit()
except:
pass


class DynamicRedirectPager(DynamicPager):
@check
Expand Down Expand Up @@ -188,8 +197,7 @@ def pre_load(self, webdriver: WebDriver) -> None:

class DynamicNumButtonPager(DynamicPager):
@check
def __init__(self, uri: str, button_selector: WebElementSelector, webdriver: Driver | WebDriver = None,
start: int = 1,
def __init__(self, uri: str, button_selector: WebElementSelector, webdriver: Driver | WebDriver = None, start: int = 1,
offset: int = 1, interval: float = 1) -> None:
"""
Based on dynamic web page analyzer (digital button flipping)
Expand Down Expand Up @@ -268,8 +276,7 @@ def pre_load(self, webdriver: WebDriver) -> None:

class DynamicNextButtonPager(DynamicPager):
@check
def __init__(self, uri: str, button_selector: WebElementSelector, webdriver: Driver | WebDriver = None,
start: int = 1,
def __init__(self, uri: str, button_selector: WebElementSelector, webdriver: Driver | WebDriver = None, start: int = 1,
offset: int = 1, interval: float = 1) -> None:
"""
Based on dynamic web page analyzer (click the next page button to page)
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 = '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'
Expand Down

0 comments on commit 566e7f6

Please sign in to comment.