Toggle navigation
Toggle navigation
This project
Loading...
Sign in
万朱浩
/
Venue-Ops
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Doiiars
2026-03-07 10:48:35 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
326d5b8c1940ffe0894a3130de1bc39fd1ec9c83
326d5b8c
1 parent
f30580f1
MindSpider README: 补充uv run示例、DB_DIALECT配置、修正依赖安装描述
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
9 deletions
MindSpider/README.md
MindSpider/README.md
View file @
326d5b8
...
...
@@ -25,7 +25,7 @@ MindSpider 运行示例
-
**编程语言**
: Python 3.9+
-
**AI框架**
: 默认Deepseek,可以接入多种api (话题提取与分析)
-
**爬虫框架**
: Playwright (浏览器自动化)
-
**数据库**
: MySQL (数据持久化存储)
-
**数据库**
: MySQL
/ PostgreSQL
(数据持久化存储)
-
**并发处理**
: AsyncIO (异步并发爬取)
## 项目结构
...
...
@@ -223,7 +223,7 @@ cd BettaFish/MindSpider
git submodule update --init --recursive
```
> **注意**:MediaCrawler 的 Python 依赖会在首次运行 `
python main.py` 时由系统自动检测并静默
安装到当前环境。
> **注意**:MediaCrawler 的 Python 依赖会在首次运行 `
uv run main.py --deep-sentiment` 时由系统自动检测并
安装到当前环境。
### 2. 创建并激活环境
...
...
@@ -275,13 +275,18 @@ playwright install
复制.env.example文件为.env文件,放置在项目根目录。编辑
`.env`
文件,设置数据库和API配置:
```
python
# MySQL数据库配置
# 数据库配置(MySQL 示例)
DB_DIALECT
=
"mysql"
# mysql 或 postgresql
DB_HOST
=
"your_database_host"
DB_PORT
=
3306
DB_USER
=
"your_username"
DB_PASSWORD
=
"your_password"
DB_NAME
=
"mindspider"
DB_CHARSET
=
"utf8mb4"
DB_CHARSET
=
"utf8mb4"
# PostgreSQL 时可省略此项
# PostgreSQL 示例(将上方 DB_DIALECT 改为 postgresql,DB_PORT 改为 5432)
# DB_DIALECT = "postgresql"
# DB_PORT = 5432
# MINDSPIDER API密钥
MINDSPIDER_BASE_URL
=
your_api_base_url
...
...
@@ -294,6 +299,8 @@ MINDSPIDER_MODEL_NAME=deepseek-chat
```
bash
# 检查系统状态
python main.py --status
# 或
uv run main.py --status
```
## 使用指南
...
...
@@ -303,12 +310,18 @@ python main.py --status
```
bash
# 1. 运行话题提取(获取热点新闻和关键词)
python main.py --broad-topic
# 或
uv run main.py --broad-topic
# 2. 运行爬虫(基于关键词爬取各平台内容)
python main.py --deep-sentiment --test
# 或
uv run main.py --deep-sentiment --test
# 或者一次性运行完整流程
python main.py --complete --test
# 或
uv run main.py --complete --test
```
### 单独使用模块
...
...
@@ -316,12 +329,18 @@ python main.py --complete --test
```
bash
# 只获取今日热点和关键词
python main.py --broad-topic
# 或
uv run main.py --broad-topic
# 只爬取特定平台
python main.py --deep-sentiment --platforms xhs dy --test
# 或
uv run main.py --deep-sentiment --platforms xhs dy --test
# 指定日期
python main.py --broad-topic --date 2024-01-15
# 或
uv run main.py --broad-topic --date 2024-01-15
```
## 爬虫配置(重要)
...
...
@@ -334,6 +353,8 @@ python main.py --broad-topic --date 2024-01-15
```
bash
# 测试小红书爬取(会弹出二维码)
python main.py --deep-sentiment --platforms xhs --test
# 或
uv run main.py --deep-sentiment --platforms xhs --test
# 用小红书APP扫码登录,登录成功后会自动保存状态
```
...
...
@@ -341,25 +362,27 @@ python main.py --deep-sentiment --platforms xhs --test
```
bash
# 测试抖音爬取
python main.py --deep-sentiment --platforms dy --test
# 或
uv run main.py --deep-sentiment --platforms dy --test
# 用抖音APP扫码登录
```
3.
**其他平台同理**
```
bash
# 快手
pytho
n main.py --deep-sentiment --platforms ks --test
uv ru
n main.py --deep-sentiment --platforms ks --test
# B站
pytho
n main.py --deep-sentiment --platforms bili --test
uv ru
n main.py --deep-sentiment --platforms bili --test
# 微博
pytho
n main.py --deep-sentiment --platforms wb --test
uv ru
n main.py --deep-sentiment --platforms wb --test
# 贴吧
pytho
n main.py --deep-sentiment --platforms tieba --test
uv ru
n main.py --deep-sentiment --platforms tieba --test
# 知乎
pytho
n main.py --deep-sentiment --platforms zhihu --test
uv ru
n main.py --deep-sentiment --platforms zhihu --test
```
### 登录问题排除
...
...
@@ -385,9 +408,13 @@ https://github.com/666ghj/BettaFish/issues/185
```
bash
# 小规模测试(推荐先这样测试)
python main.py --complete --test
# 或
uv run main.py --complete --test
# 调整爬取数量
python main.py --complete --max-keywords 20 --max-notes 30
# 或
uv run main.py --complete --max-keywords 20 --max-notes 30
```
### 高级功能
...
...
@@ -396,18 +423,26 @@ python main.py --complete --max-keywords 20 --max-notes 30
```
bash
# 提取指定日期的话题
python main.py --broad-topic --date 2024-01-15
# 或
uv run main.py --broad-topic --date 2024-01-15
# 爬取指定日期的内容
python main.py --deep-sentiment --date 2024-01-15
# 或
uv run main.py --deep-sentiment --date 2024-01-15
```
#### 2. 指定平台爬取
```
bash
# 只爬取B站和抖音
python main.py --deep-sentiment --platforms bili dy --test
# 或
uv run main.py --deep-sentiment --platforms bili dy --test
# 爬取所有平台的特定数量内容
python main.py --deep-sentiment --max-keywords 30 --max-notes 20
# 或
uv run main.py --deep-sentiment --max-keywords 30 --max-notes 20
```
## 常用参数
...
...
@@ -443,12 +478,16 @@ HEADLESS = False
# 重新运行登录
python main.py --deep-sentiment --platforms xhs --test
# 或
uv run main.py --deep-sentiment --platforms xhs --test
```
### 2. 数据库连接失败
```
bash
# 检查配置
python main.py --status
# 或
uv run main.py --status
# 检查config.py中的数据库配置是否正确
```
...
...
Please
register
or
login
to post a comment