Commit 49ccfcd8 authored by liyang's avatar liyang

feat:ins爬虫数据条件过滤优化

parent 0d1ca3e0
...@@ -101,17 +101,20 @@ def create(option=None, using_user_data=True, web_browser="firefox"): ...@@ -101,17 +101,20 @@ def create(option=None, using_user_data=True, web_browser="firefox"):
if platform.system() == "Windows": if platform.system() == "Windows":
binary_location = os.path.join(os.path.abspath("../"), 'network-assets-reptile', 'browser', "chrome_win64", binary_location = os.path.join(os.path.abspath("../"), 'network-assets-reptile', 'browser', "chrome_win64",
"chrome.exe") "chrome.exe")
webdriver_location = os.path.join(os.path.abspath("../"), 'network-assets-reptile', 'browser',"web-driver","chromedriver_win32", webdriver_location = os.path.join(os.path.abspath("../"), 'network-assets-reptile', 'browser', "web-driver",
"chromedriver_win32",
"chromedriver.exe") "chromedriver.exe")
elif platform.system() == "Linux": elif platform.system() == "Linux":
binary_location = os.path.join(os.path.abspath("../"), 'network-assets-reptile', 'browser', binary_location = os.path.join(os.path.abspath("../"), 'network-assets-reptile', 'browser',
"chrome-linux64", "chrome") "chrome-linux64", "chrome")
webdriver_location = os.path.join(os.path.abspath("../"), 'network-assets-reptile', 'browser',"web-driver","chromedriver_linux64", webdriver_location = os.path.join(os.path.abspath("../"), 'network-assets-reptile', 'browser', "web-driver",
"chromedriver_linux64",
"chromedriver") "chromedriver")
elif platform.system() == "Darwin": elif platform.system() == "Darwin":
binary_location = os.path.join(os.path.abspath("../"), 'network-assets-reptile', 'browser', binary_location = os.path.join(os.path.abspath("../"), 'network-assets-reptile', 'browser',
"chrome-mac-x64", "chrome.app") "chrome-mac-x64", "chrome.app")
webdriver_location = os.path.join(os.path.abspath("../"), 'network-assets-reptile', 'browser',"web-driver","chromedriver_mac64", webdriver_location = os.path.join(os.path.abspath("../"), 'network-assets-reptile', 'browser', "web-driver",
"chromedriver_mac64",
"chromedriver") "chromedriver")
else: else:
print("") print("")
...@@ -124,14 +127,16 @@ def create(option=None, using_user_data=True, web_browser="firefox"): ...@@ -124,14 +127,16 @@ def create(option=None, using_user_data=True, web_browser="firefox"):
# service = ChromeService(executable_path=webdriver_location) # service = ChromeService(executable_path=webdriver_location)
service = ChromeService(executable_path=webdriver_location) service = ChromeService(executable_path=webdriver_location)
# service=service=ChromeService(ChromeDriverManager().install()) # service=service=ChromeService(ChromeDriverManager().install())
browser = webdriver.Chrome(options=options,service=service) browser = webdriver.Chrome(options=options, service=service)
elif web_browser == "edge": elif web_browser == "edge":
browser = webdriver.Edge(options=options,service=EdgeService(EdgeChromiumDriverManager().install())) browser = webdriver.Edge(options=options, service=EdgeService(EdgeChromiumDriverManager().install()))
else: else:
print("") print("")
if option is None:
# 获取屏幕分辨率 # 获取屏幕分辨率
width, height = get_screen_resolution() width, height = get_screen_resolution()
# 设置窗口大小为全屏 # 设置窗口大小为全屏
browser.set_window_size(width, height) browser.set_window_size(width, height)
return browser return browser
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment