首次提交: OnebotCatalog 项目代码与文档(含 NX 按需生成服务二期、后台、一键启动)
This commit is contained in:
68
blog_mirror/run.bat
Normal file
68
blog_mirror/run.bat
Normal file
@@ -0,0 +1,68 @@
|
||||
@echo off
|
||||
setlocal
|
||||
chcp 65001 >nul
|
||||
set PYTHONIOENCODING=utf-8
|
||||
cd /d "%~dp0"
|
||||
|
||||
echo ============================================
|
||||
echo Website Mirror Crawler
|
||||
echo Target: http://171.80.3.206:39897/
|
||||
echo ============================================
|
||||
echo.
|
||||
|
||||
set "PY="
|
||||
|
||||
python --version >nul 2>nul
|
||||
if not errorlevel 1 (
|
||||
set "PY=python"
|
||||
goto :found
|
||||
)
|
||||
|
||||
py -3 --version >nul 2>nul
|
||||
if not errorlevel 1 (
|
||||
set "PY=py -3"
|
||||
goto :found
|
||||
)
|
||||
|
||||
python3 --version >nul 2>nul
|
||||
if not errorlevel 1 (
|
||||
set "PY=python3"
|
||||
goto :found
|
||||
)
|
||||
|
||||
if exist "C:\Users\ruigu\AppData\Local\Programs\Python\Python310\python.exe" (
|
||||
set "PY=C:\Users\ruigu\AppData\Local\Programs\Python\Python310\python.exe"
|
||||
goto :found
|
||||
)
|
||||
|
||||
echo [ERROR] No Python found.
|
||||
echo Install Python 3.8+ from https://www.python.org/downloads/
|
||||
echo During install, check the box "Add Python to PATH".
|
||||
echo Then double-click this file again.
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:found
|
||||
echo Using Python: %PY%
|
||||
echo.
|
||||
|
||||
echo [1/3] Checking dependencies...
|
||||
%PY% -c "import requests, bs4" >nul 2>nul
|
||||
if errorlevel 1 (
|
||||
echo [1/3] Installing requests and beautifulsoup4 ...
|
||||
%PY% -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple requests beautifulsoup4
|
||||
) else (
|
||||
echo [1/3] Dependencies OK
|
||||
)
|
||||
|
||||
echo.
|
||||
echo [2/3] Crawling site ... this may take minutes. Do NOT close this window.
|
||||
echo.
|
||||
%PY% -u mirror.py http://171.80.3.206:39897/
|
||||
|
||||
echo.
|
||||
echo [3/3] Done! Offline copy is here:
|
||||
echo %~dp0mirror\171.80.3.206_39897\
|
||||
echo Open index.html inside that folder with your browser.
|
||||
echo.
|
||||
pause
|
||||
Reference in New Issue
Block a user