Skip to content

Commit 2bc9297

Browse files
committed
docs: Move data storage section to separate guide
- Create comprehensive data storage guide (docs/data_storage_guide.md) - Update README.md with link to storage guide instead of full details - Update README_en.md with link to storage guide - Bilingual guide (Chinese and English) in single document - Includes all storage options: CSV, JSON, Excel, SQLite, MySQL - Detailed usage examples and documentation links This change improves README readability by moving detailed storage information to a dedicated document while keeping main README concise.
1 parent ba64c8f commit 2bc9297

File tree

3 files changed

+121
-65
lines changed

3 files changed

+121
-65
lines changed

README.md

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -209,40 +209,9 @@ python main.py --help
209209

210210
## 💾 数据保存
211211

212-
支持多种数据存储方式:
213-
- **CSV 文件**:支持保存到 CSV 中(`data/` 目录下)
214-
- **JSON 文件**:支持保存到 JSON 中(`data/` 目录下)
215-
- **Excel 文件**:支持保存到格式化的 Excel 文件(`data/` 目录下)✨ 新功能
216-
- 多工作表支持(内容、评论、创作者)
217-
- 专业格式化(标题样式、自动列宽、边框)
218-
- 易于分析和分享
219-
- **数据库存储**
220-
- 使用参数 `--init_db` 进行数据库初始化(使用`--init_db`时不需要携带其他optional)
221-
- **SQLite 数据库**:轻量级数据库,无需服务器,适合个人使用(推荐)
222-
1. 初始化:`--init_db sqlite`
223-
2. 数据存储:`--save_data_option sqlite`
224-
- **MySQL 数据库**:支持关系型数据库 MySQL 中保存(需要提前创建数据库)
225-
1. 初始化:`--init_db mysql`
226-
2. 数据存储:`--save_data_option db`(db 参数为兼容历史更新保留)
227-
228-
229-
### 使用示例:
230-
```shell
231-
# 初始化 SQLite 数据库
232-
uv run main.py --init_db sqlite
233-
# 使用 SQLite 存储数据
234-
uv run main.py --platform xhs --lt qrcode --type search --save_data_option sqlite
235-
236-
# 使用 Excel 存储数据(推荐用于数据分析)
237-
uv run main.py --platform xhs --lt qrcode --type search --save_data_option excel
238-
```
212+
MediaCrawler 支持多种数据存储方式,包括 CSV、JSON、Excel、SQLite 和 MySQL 数据库。
239213

240-
```shell
241-
# 初始化 MySQL 数据库
242-
uv run main.py --init_db mysql
243-
# 使用 MySQL 存储数据(为适配历史更新,db参数进行沿用)
244-
uv run main.py --platform xhs --lt qrcode --type search --save_data_option db
245-
```
214+
📖 **详细使用说明请查看:[数据存储指南](docs/data_storage_guide.md)**
246215

247216

248217
[🚀 MediaCrawlerPro 重磅发布 🚀!更多的功能,更好的架构设计!](https://github.com/MediaCrawlerPro)

README_en.md

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -206,39 +206,9 @@ python main.py --help
206206

207207
## 💾 Data Storage
208208

209-
Supports multiple data storage methods:
210-
- **CSV Files**: Supports saving to CSV (under `data/` directory)
211-
- **JSON Files**: Supports saving to JSON (under `data/` directory)
212-
- **Excel Files**: Supports saving to formatted Excel files (under `data/` directory) ✨ New Feature
213-
- Multi-sheet support (Contents, Comments, Creators)
214-
- Professional formatting (styled headers, auto-width columns, borders)
215-
- Easy to analyze and share
216-
- **Database Storage**
217-
- Use the `--init_db` parameter for database initialization (when using `--init_db`, no other optional arguments are needed)
218-
- **SQLite Database**: Lightweight database, no server required, suitable for personal use (recommended)
219-
1. Initialization: `--init_db sqlite`
220-
2. Data Storage: `--save_data_option sqlite`
221-
- **MySQL Database**: Supports saving to relational database MySQL (database needs to be created in advance)
222-
1. Initialization: `--init_db mysql`
223-
2. Data Storage: `--save_data_option db` (the db parameter is retained for compatibility with historical updates)
224-
225-
226-
### Usage Examples:
227-
```shell
228-
# Use Excel to store data (recommended for data analysis) ✨ New Feature
229-
uv run main.py --platform xhs --lt qrcode --type search --save_data_option excel
209+
MediaCrawler supports multiple data storage methods, including CSV, JSON, Excel, SQLite, and MySQL databases.
230210

231-
# Initialize SQLite database (when using '--init_db', no other optional arguments are needed)
232-
uv run main.py --init_db sqlite
233-
# Use SQLite to store data (recommended for personal users)
234-
uv run main.py --platform xhs --lt qrcode --type search --save_data_option sqlite
235-
```
236-
```shell
237-
# Initialize MySQL database
238-
uv run main.py --init_db mysql
239-
# Use MySQL to store data (the db parameter is retained for compatibility with historical updates)
240-
uv run main.py --platform xhs --lt qrcode --type search --save_data_option db
241-
```
211+
📖 **For detailed usage instructions, please see: [Data Storage Guide](docs/data_storage_guide.md)**
242212

243213
---
244214

docs/data_storage_guide.md

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# 数据保存指南 / Data Storage Guide
2+
3+
[English](#english) | [中文](#中文)
4+
5+
---
6+
7+
## 中文
8+
9+
### 💾 数据保存
10+
11+
MediaCrawler 支持多种数据存储方式,您可以根据需求选择最适合的方案:
12+
13+
#### 存储方式
14+
15+
- **CSV 文件**:支持保存到 CSV 中(`data/` 目录下)
16+
- **JSON 文件**:支持保存到 JSON 中(`data/` 目录下)
17+
- **Excel 文件**:支持保存到格式化的 Excel 文件(`data/` 目录下)✨ 新功能
18+
- 多工作表支持(内容、评论、创作者)
19+
- 专业格式化(标题样式、自动列宽、边框)
20+
- 易于分析和分享
21+
- **数据库存储**
22+
- 使用参数 `--init_db` 进行数据库初始化(使用`--init_db`时不需要携带其他optional)
23+
- **SQLite 数据库**:轻量级数据库,无需服务器,适合个人使用(推荐)
24+
1. 初始化:`--init_db sqlite`
25+
2. 数据存储:`--save_data_option sqlite`
26+
- **MySQL 数据库**:支持关系型数据库 MySQL 中保存(需要提前创建数据库)
27+
1. 初始化:`--init_db mysql`
28+
2. 数据存储:`--save_data_option db`(db 参数为兼容历史更新保留)
29+
30+
#### 使用示例
31+
32+
```shell
33+
# 使用 Excel 存储数据(推荐用于数据分析)✨ 新功能
34+
uv run main.py --platform xhs --lt qrcode --type search --save_data_option excel
35+
36+
# 初始化 SQLite 数据库
37+
uv run main.py --init_db sqlite
38+
# 使用 SQLite 存储数据
39+
uv run main.py --platform xhs --lt qrcode --type search --save_data_option sqlite
40+
```
41+
42+
```shell
43+
# 初始化 MySQL 数据库
44+
uv run main.py --init_db mysql
45+
# 使用 MySQL 存储数据(为适配历史更新,db参数进行沿用)
46+
uv run main.py --platform xhs --lt qrcode --type search --save_data_option db
47+
```
48+
49+
```shell
50+
# 使用 CSV 存储数据
51+
uv run main.py --platform xhs --lt qrcode --type search --save_data_option csv
52+
53+
# 使用 JSON 存储数据
54+
uv run main.py --platform xhs --lt qrcode --type search --save_data_option json
55+
```
56+
57+
#### 详细文档
58+
59+
- **Excel 导出详细指南**:查看 [Excel 导出指南](excel_export_guide.md)
60+
- **数据库配置**:参考 [常见问题](常见问题.md)
61+
62+
---
63+
64+
## English
65+
66+
### 💾 Data Storage
67+
68+
MediaCrawler supports multiple data storage methods. Choose the one that best fits your needs:
69+
70+
#### Storage Options
71+
72+
- **CSV Files**: Supports saving to CSV (under `data/` directory)
73+
- **JSON Files**: Supports saving to JSON (under `data/` directory)
74+
- **Excel Files**: Supports saving to formatted Excel files (under `data/` directory) ✨ New Feature
75+
- Multi-sheet support (Contents, Comments, Creators)
76+
- Professional formatting (styled headers, auto-width columns, borders)
77+
- Easy to analyze and share
78+
- **Database Storage**
79+
- Use the `--init_db` parameter for database initialization (when using `--init_db`, no other optional arguments are needed)
80+
- **SQLite Database**: Lightweight database, no server required, suitable for personal use (recommended)
81+
1. Initialization: `--init_db sqlite`
82+
2. Data Storage: `--save_data_option sqlite`
83+
- **MySQL Database**: Supports saving to relational database MySQL (database needs to be created in advance)
84+
1. Initialization: `--init_db mysql`
85+
2. Data Storage: `--save_data_option db` (the db parameter is retained for compatibility with historical updates)
86+
87+
#### Usage Examples
88+
89+
```shell
90+
# Use Excel to store data (recommended for data analysis) ✨ New Feature
91+
uv run main.py --platform xhs --lt qrcode --type search --save_data_option excel
92+
93+
# Initialize SQLite database
94+
uv run main.py --init_db sqlite
95+
# Use SQLite to store data
96+
uv run main.py --platform xhs --lt qrcode --type search --save_data_option sqlite
97+
```
98+
99+
```shell
100+
# Initialize MySQL database
101+
uv run main.py --init_db mysql
102+
# Use MySQL to store data (the db parameter is retained for compatibility with historical updates)
103+
uv run main.py --platform xhs --lt qrcode --type search --save_data_option db
104+
```
105+
106+
```shell
107+
# Use CSV to store data
108+
uv run main.py --platform xhs --lt qrcode --type search --save_data_option csv
109+
110+
# Use JSON to store data
111+
uv run main.py --platform xhs --lt qrcode --type search --save_data_option json
112+
```
113+
114+
#### Detailed Documentation
115+
116+
- **Excel Export Guide**: See [Excel Export Guide](excel_export_guide.md)
117+
- **Database Configuration**: Refer to [FAQ](常见问题.md)

0 commit comments

Comments
 (0)