48 lines
1.0 KiB
Batchfile
48 lines
1.0 KiB
Batchfile
|
|
@echo off
|
||
|
|
|
||
|
|
echo WeChat Public Article Crawler Startup Script
|
||
|
|
echo =================================
|
||
|
|
|
||
|
|
REM Check if cookie.txt file exists
|
||
|
|
if not exist "cookie.txt" (
|
||
|
|
echo Error: cookie.txt file not found!
|
||
|
|
echo Please create cookie.txt file in backend directory and add WeChat public platform cookie information.
|
||
|
|
echo.
|
||
|
|
echo cookie.txt format example:
|
||
|
|
echo __biz=xxx; uin=xxx; key=xxx; pass_ticket=xxx;
|
||
|
|
echo.
|
||
|
|
pause
|
||
|
|
exit /b 1
|
||
|
|
)
|
||
|
|
|
||
|
|
REM Set Go environment variables (if needed)
|
||
|
|
REM set GOPATH=%USERPROFILE%\go
|
||
|
|
REM set GOROOT=C:\Go
|
||
|
|
REM set PATH=%PATH%;%GOROOT%\bin;%GOPATH%\bin
|
||
|
|
|
||
|
|
echo Downloading dependencies...
|
||
|
|
go mod tidy
|
||
|
|
if %errorlevel% neq 0 (
|
||
|
|
echo Failed to download dependencies!
|
||
|
|
pause
|
||
|
|
exit /b 1
|
||
|
|
)
|
||
|
|
|
||
|
|
echo Compiling program...
|
||
|
|
go build -o output\wechat-crawler.exe cmd\main.go
|
||
|
|
if %errorlevel% neq 0 (
|
||
|
|
echo Compilation failed!
|
||
|
|
pause
|
||
|
|
exit /b 1
|
||
|
|
)
|
||
|
|
|
||
|
|
echo Compilation successful! Starting program...
|
||
|
|
echo.
|
||
|
|
|
||
|
|
REM Ensure data directory exists
|
||
|
|
if not exist "data" mkdir data
|
||
|
|
|
||
|
|
REM Run the program
|
||
|
|
output\wechat-crawler.exe
|
||
|
|
|
||
|
|
pause
|