加入定时任务

This commit is contained in:
liuwei
2025-05-06 16:51:33 +08:00
parent 2ff2f4c23b
commit a9e8e7b2be

View File

@@ -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)