mirror of
https://github.com/NanmiCoder/MediaCrawler.git
synced 2026-04-21 19:27:40 +08:00
refactor(database): 调整数据库模块位置、调整初始化arg名称,并更新文档
- 将 db.py 数据库模块移入‘database/‘中,并修正所有调用代码 - 将初始化参数 `--init-db` 改为 `--init_db` - 更新相关文档说明
This commit is contained in:
26
README_en.md
26
README_en.md
@@ -194,21 +194,29 @@ python main.py --help
|
||||
## 💾 Data Storage
|
||||
|
||||
Supports multiple data storage methods:
|
||||
|
||||
- **SQLite Database**: Lightweight database without server, ideal for personal use (recommended)
|
||||
- Parameter: `--save_data_option sqlite`
|
||||
- Database file created automatically
|
||||
- **MySQL Database**: Supports saving to relational database MySQL (need to create database in advance)
|
||||
- Execute `python db.py` to initialize database table structure (only execute on first run)
|
||||
- **CSV Files**: Supports saving to CSV (under `data/` directory)
|
||||
- **JSON Files**: Supports saving to JSON (under `data/` directory)
|
||||
- **Database Storage**
|
||||
- Use the `--init_db` parameter for database initialization (when using `--init_db`, no other optional arguments are needed)
|
||||
- **SQLite Database**: Lightweight database, no server required, suitable for personal use (recommended)
|
||||
1. Initialization: `--init_db sqlite`
|
||||
2. Data Storage: `--save_data_option sqlite`
|
||||
- **MySQL Database**: Supports saving to relational database MySQL (database needs to be created in advance)
|
||||
1. Initialization: `--init_db mysql`
|
||||
2. Data Storage: `--save_data_option db` (the db parameter is retained for compatibility with historical updates)
|
||||
|
||||
|
||||
### Usage Examples:
|
||||
```shell
|
||||
# Use SQLite (recommended for personal users)
|
||||
# Initialize SQLite database (when using '--init_db', no other optional arguments are needed)
|
||||
uv run main.py --init_db sqlite
|
||||
# Use SQLite to store data (recommended for personal users)
|
||||
uv run main.py --platform xhs --lt qrcode --type search --save_data_option sqlite
|
||||
|
||||
# Use MySQL
|
||||
```
|
||||
```shell
|
||||
# Initialize MySQL database
|
||||
uv run main.py --init_db mysql
|
||||
# Use MySQL to store data (the db parameter is retained for compatibility with historical updates)
|
||||
uv run main.py --platform xhs --lt qrcode --type search --save_data_option db
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user