@echo off rem GUI mode (no black window). Debug: set DOUYIN_CONSOLE=1 if /i not "%DOUYIN_CONSOLE%"=="1" ( wscript.exe //nologo "%~dp0run_collector.vbs" exit /b 0 ) if exist "%~dp0splash.html" start "" "%~dp0splash.html" set "SPLASH_LAUNCHED=1" setlocal EnableExtensions set "PATH=%SystemRoot%\System32;%PATH%" cd /d "%~dp0" if exist "%SystemRoot%\System32\chcp.com" ( "%SystemRoot%\System32\chcp.com" 65001 >nul 2>&1 ) if /i "%DOUYIN_USE_EXE%"=="1" goto :try_exe if exist ".venv\Scripts\python.exe" goto :python_dev :try_exe for %%F in ("%~dp0*.exe") do ( if /i not "%%~nxF"=="uninstall.exe" ( echo Starting collector (exe)... "%%~fF" if errorlevel 1 pause exit /b %ERRORLEVEL% ) ) for /d %%D in ("%~dp0dist\*") do ( for %%F in ("%%D\*.exe") do ( echo Starting collector (exe)... "%%~fF" if errorlevel 1 pause exit /b %ERRORLEVEL% ) ) :python_dev if not exist ".venv\Scripts\python.exe" ( call "%~dp0setup.bat" silent if not exist ".venv\Scripts\python.exe" ( echo Install failed. pause exit /b 1 ) ) set "PY=.venv\Scripts\python.exe" set "PLAYWRIGHT_BROWSERS_PATH=%~dp0playwright-browsers" if not exist "%PLAYWRIGHT_BROWSERS_PATH%" mkdir "%PLAYWRIGHT_BROWSERS_PATH%" powershell -NoProfile -ExecutionPolicy Bypass -Command "8765..8770|ForEach-Object{Get-NetTCPConnection -LocalPort $_ -State Listen -ErrorAction SilentlyContinue|ForEach-Object{Stop-Process -Id $_.OwningProcess -Force -ErrorAction SilentlyContinue}}" >nul 2>&1 set "HAS_CHROME=0" for /d %%D in ("%PLAYWRIGHT_BROWSERS_PATH%\chromium-*") do ( if exist "%%D\chrome-win64\chrome.exe" set "HAS_CHROME=1" if exist "%%D\chrome-win\chrome.exe" set "HAS_CHROME=1" ) if "%HAS_CHROME%"=="0" ( "%PY%" -m playwright install chromium ) set "COLLECTOR_GUI=0" "%PY%" "%~dp0run_douyin_collector.py" if errorlevel 1 pause endlocal