Files
yixiaogao/backend/run_article_link.bat
2025-11-26 18:44:12 +08:00

57 lines
1.3 KiB
Batchfile

@echo off
rem WeChat Official Account Article Crawler - Script for crawling via article link
setlocal enabledelayedexpansion
REM 检查是否有命令行参数传入
if "%1" neq "" (
REM 如果有参数,直接将其作为文章链接传入程序
echo.
echo Compiling and running...
go run "cmd/main.go" "%1"
if errorlevel 1 (
echo.
echo Failed to run, please check error messages above
pause
exit /b 1
)
echo.
echo Crawling completed successfully!
pause
exit /b 0
) else (
REM 如果没有参数,运行交互式模式
:input_loop
cls
echo ========================================
echo WeChat Official Account Article Crawler
echo ========================================
echo.
echo Please enter WeChat article link:
echo Example: https://mp.weixin.qq.com/s/4r_LKJu0mOeUc70ZZXK9LA
set /p ARTICLE_LINK=
if "%ARTICLE_LINK%"=="" (
echo.
echo Error: Article link cannot be empty!
pause
goto input_loop
)
echo.
echo Compiling and running...
go run "cmd/main.go" "%ARTICLE_LINK%"
if errorlevel 1 (
echo.
echo Failed to run, please check error messages above
pause
exit /b 1
)
echo.
echo Crawling completed successfully!
pause
)