|
1 | 1 | # 数据保存指南 / Data Storage Guide |
2 | 2 |
|
3 | | -[English](#english) | [中文](#中文) |
4 | | - |
5 | | ---- |
6 | | - |
7 | | -## 中文 |
8 | 3 |
|
9 | 4 | ### 💾 数据保存 |
10 | 5 |
|
@@ -60,58 +55,3 @@ uv run main.py --platform xhs --lt qrcode --type search --save_data_option json |
60 | 55 | - **数据库配置**:参考 [常见问题](常见问题.md) |
61 | 56 |
|
62 | 57 | --- |
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