From a9e8e7b2bed789591d334d96a0fa2564b602fe01 Mon Sep 17 00:00:00 2001 From: liuwei Date: Tue, 6 May 2025 16:51:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E5=AE=9A=E6=97=B6=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- xiuren/meitu_dl.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/xiuren/meitu_dl.py b/xiuren/meitu_dl.py index 76a529c..c6dd0d8 100644 --- a/xiuren/meitu_dl.py +++ b/xiuren/meitu_dl.py @@ -83,12 +83,15 @@ def fetch_images(post_url): options = Options() options.headless = True - - # 使用本地固定的ChromeDriver路径,避免每次自动更新 - chrome_driver_path = os.path.join( + # 根据操作系统选择不同的ChromeDriver路径处理方式 + if os.name == 'nt': # Windows + chrome_driver_path = os.path.join( os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "utils", "chromedriver", "chromedriver.exe" ) + else: # Linux + chrome_driver_path = 'chromedriver' # 使用系统PATH中的chromedriver + # 如果本地没有chromedriver.exe,则使用默认方式 if not os.path.exists(chrome_driver_path): driver = webdriver.Chrome(options=options)