26 lines
1020 B
Batchfile
26 lines
1020 B
Batchfile
@echo off
|
|
REM 以调试模式打开一个常驻的 Chrome 窗口,供脚本通过 --cdp 接管。
|
|
REM 使用项目内 .chrome_session 目录(非默认位置,Chrome 才允许开启远程调试),
|
|
REM 登录态会缓存在该目录,首次请手动登录 Pinterest。
|
|
|
|
setlocal
|
|
set SCRIPT_DIR=%~dp0
|
|
set UD=%SCRIPT_DIR%.chrome_session\User Data
|
|
if not exist "%UD%" mkdir "%UD%"
|
|
|
|
set CHROME="C:\Program Files\Google\Chrome\Application\chrome.exe"
|
|
if not exist %CHROME% set CHROME="%LOCALAPPDATA%\Google\Chrome\Application\chrome.exe"
|
|
|
|
start "" %CHROME% ^
|
|
--user-data-dir="%UD%" ^
|
|
--remote-debugging-port=9222 ^
|
|
--no-first-run ^
|
|
--no-default-browser-check ^
|
|
--disable-blink-features=AutomationControlled
|
|
|
|
echo 已打开调试版 Chrome(监听 9222),保持窗口打开。
|
|
echo 若 Pinterest 需要登录,请在此窗口手动登录一次(登录态会缓存在 .chrome_session)。
|
|
echo 之后运行:uv run pinterest_image_capture.py "关键词" -n 50 --cdp http://127.0.0.1:9222
|
|
pause
|
|
endlocal
|