Compare commits

..

15 Commits

Author SHA1 Message Date
77f0d404fa aa 2026-04-27 13:23:23 +08:00
cf64bc4703 aa 2026-04-27 12:06:02 +08:00
ff022bce5d aa 2026-04-27 11:43:10 +08:00
4ae6898be0 aa 2026-04-27 02:07:31 +08:00
440416ba0c aa 2026-04-27 02:02:46 +08:00
459a5299a0 aa 2026-04-27 02:00:03 +08:00
d4378afbc9 aa 2026-04-27 01:56:43 +08:00
dfb5fe0c89 aa 2026-04-27 01:45:59 +08:00
384d7e4838 aa 2026-04-27 01:42:47 +08:00
e30292e330 aa 2026-04-27 01:37:22 +08:00
ec804afc60 aa 2026-04-27 01:30:29 +08:00
4c48525b3a aa 2026-04-27 01:28:50 +08:00
b00a0c40d8 aa 2026-04-27 01:25:45 +08:00
5ec4c38495 aa 2026-04-27 01:20:49 +08:00
2d0eeaa78f aa 2026-04-27 01:19:38 +08:00
10 changed files with 3502 additions and 171 deletions

13
.dockerignore Normal file
View File

@@ -0,0 +1,13 @@
# 构建镜像时不打进上下文(减小体积;数据在宿主机卷里)
.git
.env
.env.*
*.session
*.session-journal
state.json
-100*/
__pycache__
*.pyc
.cursor
.venv
venv

41
.gitignore vendored Normal file
View File

@@ -0,0 +1,41 @@
# ========== 密钥与登录(切勿提交到远程)==========
.env
.env.*
*.session
*.session-journal
# ========== 运行状态与抓取进度(与频道数据配套,勿提交)==========
state.json
# ========== 按频道存放的抓取结果SQLite、媒体、导出文件==========
# 目录名一般为 Telegram 超级群/频道 ID-100xxxxxxxxxx
-100*/
# ========== 脚本生成的列表(可随时再生成)==========
channels_list.csv
# ========== Python ==========
__pycache__/
*.py[cod]
*$py.class
.Python
venv/
.venv/
*.egg-info/
.eggs/
dist/
build/
# ========== 编辑器 / 本地工具 ==========
.cursor/
.vscode/
.idea/
*.swp
*.swo
.DS_Store
Thumbs.db
# ========== 日志与临时文件 ===========
*.log
*.tmp
*.temp

23
Dockerfile Normal file
View File

@@ -0,0 +1,23 @@
# 运行 Web 控制台;抓取数据通过卷挂载到 /data见 docker-compose 说明
FROM python:3.11-slim
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1
WORKDIR /app
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
RUN pip install --no-cache-dir -U pip setuptools wheel \
&& pip install --no-cache-dir -r requirements.txt
COPY telegram-scraper.py app_web.py ./
COPY templates ./templates/
COPY static ./static/
EXPOSE 8000
CMD ["uvicorn", "app_web:app", "--host", "0.0.0.0", "--port", "8000"]

View File

@@ -119,6 +119,26 @@ python telegram-scraper.py
- **QR Code** (Recommended) - Scan with your phone (no phone number needed) - **QR Code** (Recommended) - Scan with your phone (no phone number needed)
- **Phone Number** - Traditional SMS verification - **Phone Number** - Traditional SMS verification
## Web Console (MVP) 🌐
You can run a simple web control panel that manages `.env` configuration and starts/stops the scraper process:
```bash
pip install -r requirements.txt
uvicorn app_web:app --host 0.0.0.0 --port 8000 --reload
```
Then open:
```text
http://127.0.0.1:8000
```
Features:
- Edit core config values from the web page (saved back to `.env`)
- Start / stop scraper process from browser
- View recent runtime logs
## Usage 📝 ## Usage 📝
The script provides a clean interactive menu: The script provides a clean interactive menu:

1117
app_web.py Normal file

File diff suppressed because it is too large Load Diff

17
docker-compose.yml Normal file
View File

@@ -0,0 +1,17 @@
# 用法(在项目根目录):
# docker compose build
# docker compose up -d
# 数据持久化:把宿主机上的项目目录挂到 /data与 app 内工作目录一致(见下方 volumes
services:
web:
build: .
image: telegram-scraper-web:local
container_name: telegram-scraper-web
restart: unless-stopped
ports:
- "8000:8000"
working_dir: /data
volumes:
# 改成你服务器上「已有代码 + .env + state + session + 各 -100* 目录」的绝对路径
- ${HOST_PROJECT_DIR:-.}:/data
command: ["uvicorn", "app_web:app", "--host", "0.0.0.0", "--port", "8000"]

View File

@@ -1,15 +1,10 @@
aiohappyeyeballs==2.6.1 # 直接依赖(子依赖由 pip 自动解析)
aiohttp==3.12.14 # 若仍装不上:请先执行 python3 --versionCentOS 自带 Python 3.6 过旧,建议安装 python39/python311 后再 pip install
aiosignal==1.4.0 Telethon>=1.28.0,<2
asyncio==3.4.3 fastapi>=0.65.0,<1
attrs==25.3.0 uvicorn>=0.17.0,<1
frozenlist==1.7.0 itsdangerous>=2.0.0
idna==3.10 jinja2>=3.0.0,<4
multidict==6.6.3 python-multipart>=0.0.5
propcache==0.3.2 qrcode>=7.3.0
pyaes==1.6.1 PySocks>=1.7.0
pyasn1==0.6.1
qrcode==8.0
rsa==4.9.1
Telethon==1.40.0
yarl==1.20.1

BIN
static/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 619 KiB

File diff suppressed because it is too large Load Diff

1564
templates/index.html Normal file

File diff suppressed because it is too large Load Diff