加入定时任务
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user