wb-sdk-pro 2.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. wb_sdk_pro-2.1.1/.gitignore +39 -0
  2. wb_sdk_pro-2.1.1/.python-version +1 -0
  3. wb_sdk_pro-2.1.1/PKG-INFO +217 -0
  4. wb_sdk_pro-2.1.1/README.md +183 -0
  5. wb_sdk_pro-2.1.1/README_RU.md +107 -0
  6. wb_sdk_pro-2.1.1/examples/basic_usage.py +29 -0
  7. wb_sdk_pro-2.1.1/models.py +20 -0
  8. wb_sdk_pro-2.1.1/parser.py +19 -0
  9. wb_sdk_pro-2.1.1/pyproject.toml +92 -0
  10. wb_sdk_pro-2.1.1/requirements.txt +9 -0
  11. wb_sdk_pro-2.1.1/run_gui.py +17 -0
  12. wb_sdk_pro-2.1.1/src/wb_parser/__init__.py +95 -0
  13. wb_sdk_pro-2.1.1/src/wb_parser/cli.py +324 -0
  14. wb_sdk_pro-2.1.1/src/wb_parser/client.py +777 -0
  15. wb_sdk_pro-2.1.1/src/wb_parser/config.py +97 -0
  16. wb_sdk_pro-2.1.1/src/wb_parser/exceptions.py +48 -0
  17. wb_sdk_pro-2.1.1/src/wb_parser/export.py +293 -0
  18. wb_sdk_pro-2.1.1/src/wb_parser/gui/__init__.py +21 -0
  19. wb_sdk_pro-2.1.1/src/wb_parser/gui/app.py +1179 -0
  20. wb_sdk_pro-2.1.1/src/wb_parser/http.py +399 -0
  21. wb_sdk_pro-2.1.1/src/wb_parser/mcp_server.py +381 -0
  22. wb_sdk_pro-2.1.1/src/wb_parser/models.py +280 -0
  23. wb_sdk_pro-2.1.1/src/wb_parser/py.typed +1 -0
  24. wb_sdk_pro-2.1.1/src/wb_parser/rank.py +203 -0
  25. wb_sdk_pro-2.1.1/src/wb_parser/reviews.py +307 -0
  26. wb_sdk_pro-2.1.1/src/wb_parser/shards.py +305 -0
  27. wb_sdk_pro-2.1.1/src/wb_parser/telegram.py +100 -0
  28. wb_sdk_pro-2.1.1/src/wb_parser/tracker.py +190 -0
  29. wb_sdk_pro-2.1.1/src/wb_parser/wallet.py +169 -0
  30. wb_sdk_pro-2.1.1/tests/test_client_and_async.py +189 -0
  31. wb_sdk_pro-2.1.1/tests/test_export_and_tracker.py +91 -0
  32. wb_sdk_pro-2.1.1/tests/test_gui_smoke.py +27 -0
  33. wb_sdk_pro-2.1.1/tests/test_mcp_and_cli.py +78 -0
  34. wb_sdk_pro-2.1.1/tests/test_models.py +90 -0
  35. wb_sdk_pro-2.1.1/tests/test_shards.py +99 -0
  36. wb_sdk_pro-2.1.1/tests/test_wallet_rank_reviews.py +186 -0
  37. wb_sdk_pro-2.1.1/uv.lock +1188 -0
@@ -0,0 +1,39 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # Virtual environments
7
+ .venv/
8
+ .venv*/
9
+ venv/
10
+ env/
11
+
12
+ # Distribution / packaging
13
+ build/
14
+ dist/
15
+ wheels/
16
+ *.egg-info/
17
+ .eggs/
18
+
19
+ # Testing / caches
20
+ .pytest_cache/
21
+ .ruff_cache/
22
+ .mypy_cache/
23
+ .coverage
24
+ htmlcov/
25
+
26
+ # Runtime / user outputs
27
+ storage/
28
+ result/
29
+ *.db
30
+ *.db-journal
31
+ *.xlsx
32
+ *.csv
33
+ *.log
34
+
35
+ # Local personal drafts / secrets
36
+ _local_drafts/
37
+ .env
38
+ *.cookies
39
+ wb_cookies.lwp
@@ -0,0 +1 @@
1
+ 3.13
@@ -0,0 +1,217 @@
1
+ Metadata-Version: 2.5
2
+ Name: wb-sdk-pro
3
+ Version: 2.1.1
4
+ Summary: All-in-One Wildberries SDK, 7-Tab Desktop GUI, CLI & MCP Server: CDN card extraction, feedbacks1/2 sharding, WB Wallet pricing, Search Rank Tracker, Smart Review Analyzer, and Excel export
5
+ Project-URL: Homepage, https://github.com/eminsk/wildberries_parser
6
+ Project-URL: Repository, https://github.com/eminsk/wildberries_parser
7
+ Project-URL: Issues, https://github.com/eminsk/wildberries_parser/issues
8
+ Author-email: eminsk <M_N_Nik@yahoo.com>
9
+ License: MIT
10
+ Keywords: customtkinter,e-commerce,marketplace,mcp,parser,price-tracker,scraper,sdk,wb,wildberries
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Internet :: WWW/HTTP :: Indexing/Search
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Requires-Python: >=3.10
23
+ Requires-Dist: curl-cffi>=0.7.0
24
+ Requires-Dist: customtkinter>=5.2.0
25
+ Requires-Dist: httpx[http2]>=0.27.0
26
+ Requires-Dist: openpyxl>=3.1.0
27
+ Requires-Dist: pillow>=10.0.0
28
+ Requires-Dist: pydantic>=2.7.0
29
+ Provides-Extra: all
30
+ Requires-Dist: pandas>=2.0.0; extra == 'all'
31
+ Provides-Extra: dataframe
32
+ Requires-Dist: pandas>=2.0.0; extra == 'dataframe'
33
+ Description-Content-Type: text/markdown
34
+
35
+ <h1 align="center">WB SDK Pro (`wb-sdk-pro`)</h1>
36
+ <p align="center">
37
+ <b>All-in-One Wildberries Suite: Catalog Parser + WB Wallet Pricing + Search Rank Tracker + Smart Review Analyzer + Desktop GUI &amp; MCP Server</b>
38
+ </p>
39
+
40
+ <p align="center">
41
+ <b>🇬🇧 English</b> •
42
+ <a href="https://github.com/eminsk/wildberries_parser/blob/master/README_RU.md">🇷🇺 Документация на русском</a>
43
+ </p>
44
+
45
+ [![PyPI Version](https://img.shields.io/pypi/v/wb-sdk-pro.svg?style=flat&logo=pypi&color=blue)](https://pypi.org/project/wb-sdk-pro/)
46
+ [![Release](https://img.shields.io/badge/release-v2.1.1-7c3aed.svg?style=flat&logo=github)](https://github.com/eminsk/wildberries_parser/releases/tag/v2.1.1)
47
+ [![Python Versions](https://img.shields.io/badge/python-3.10%20--%203.13+-3776AB.svg?style=flat&logo=python&logoColor=white)](https://www.python.org/)
48
+ [![uv Powered](https://img.shields.io/badge/uv-package%20manager-DE5FE9.svg?style=flat)](https://github.com/astral-sh/uv)
49
+ [![Tests](https://img.shields.io/badge/pytest-24%20passed-2ea44f.svg?style=flat&logo=pytest&logoColor=white)](https://github.com/eminsk/wildberries_parser/tree/master/tests)
50
+ [![Desktop GUI](https://img.shields.io/badge/Desktop%20GUI-7%20Tabs%20%7C%20CustomTkinter-blueviolet.svg?style=flat)](https://github.com/eminsk/wildberries_parser#desktop-gui)
51
+ [![MCP Server](https://img.shields.io/badge/MCP-8%20Tools%20JSON--RPC%202.0-00C853.svg?style=flat)](https://github.com/eminsk/wildberries_parser#mcp-server-for-ai-agents)
52
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat)](https://opensource.org/licenses/MIT)
53
+
54
+ > **Unified 3-in-1 Wildberries Architecture** upgrading and merging `wildberries_parser` + `wb_rank` + `wb_smart_review` into one modular, type-safe SDK, Desktop App, CLI, and MCP Server.
55
+
56
+ ---
57
+
58
+ ## 🚀 Unified Modules & Features
59
+
60
+ | Module | What It Solves | Highlights |
61
+ |---|---|---|
62
+ | **Catalog & CDN Engine** (`wb_parser.shards`, `client`) | Broken `basket-15` caps, 404 `.jpg` links & Issue #2 (`feedbacks1/2`) | Dynamic live sync (`basket-01..65+`, articles up to `2.88B+`), real `.webp` URLs, `root_id % 100 >= 50` feedback routing, direct `card.json` without WBAAS blocks |
63
+ | **WB Wallet Pricing** (`wb_parser.wallet`) | Calculating real buyer checkout price with `WB Кошелёк` / `ВБ Клуб` | Fetches live `default-payment.json` + `settings-front.json` thresholds (`wlt1DiscountDisplayMaxPrice`), floors prices via `ROUND_FLOOR` |
64
+ | **Search Rank Tracker** (`wb_parser.rank`) | Monitoring keyword positions across WB search (`wb_rank`) | Scans pages `1..N` (Top 100–500+), saves SQLite history, calculates position deltas (`▲ +5` / `▼ -3`), exports styled Excel `.xlsx` |
65
+ | **Smart Review Analyzer** (`wb_parser.reviews`) | Extracting buyer pros, cons & size fit (`wb_smart_review`) | Filters reviews by exact `nm_id` color or whole `root_id`, runs **instant Zero-API offline pros/cons/size analysis** OR optional OpenAI-compatible LLM summary |
66
+ | **Desktop GUI (`wb-gui`)** | Visual control center without touching terminal | Dark `CustomTkinter` UI with 7 tabs (Parser, Catalog Feed, Rank Tracker, Smart Reviews, Proxy & Session, Telegram, Logs) |
67
+ | **Native MCP Server (`wb-mcp`)** | Giving AI agents live Wildberries market intelligence | 8 JSON-RPC 2.0 tools for Claude Desktop, Cursor, Windsurf, and Antigravity |
68
+
69
+ ---
70
+
71
+ ## 📦 Installation (`uv` / `pip`)
72
+
73
+ ```bash
74
+ # Using uv (recommended)
75
+ uv add wb-sdk-pro
76
+
77
+ # Or run GUI / CLI ephemerally via uvx
78
+ uvx --from wb-sdk-pro wb-gui
79
+
80
+ # Or via pip
81
+ pip install wb-sdk-pro
82
+ ```
83
+
84
+ From source:
85
+ ```bash
86
+ git clone https://github.com/eminsk/wildberries_parser.git
87
+ cd wildberries_parser
88
+ uv sync
89
+ ```
90
+
91
+ ---
92
+
93
+ ## ⚡ Quick Start — Python Library
94
+
95
+ ### 1. Card Inspection, Sharded Feedbacks & Excel Export
96
+
97
+ ```python
98
+ from wb_parser import WBClient, to_excel
99
+
100
+ with WBClient(tracker_db="wb_prices.db") as wb:
101
+ wb.sync_upstreams()
102
+ item = wb.get_product("https://www.wildberries.ru/catalog/141217830/detail.aspx")
103
+ print(item.name, item.brand, f"Reviews: {item.feedback_count} (★ {item.valuation})")
104
+ to_excel([item], "result/wb_catalog.xlsx")
105
+ ```
106
+
107
+ ### 2. WB Wallet Discount Price (`wb_parser.wallet`)
108
+
109
+ ```python
110
+ from wb_parser import WBClient
111
+
112
+ with WBClient() as wb:
113
+ res = wb.wallet_price(4990)
114
+ print(f"Base: {res.base_price} ₽ -> With WB Wallet (-{res.discount_pct}%): {res.wallet_price} ₽")
115
+ ```
116
+
117
+ ### 3. Search Rank Tracking (`wb_parser.rank`)
118
+
119
+ ```python
120
+ from wb_parser import WBClient, rank_results_to_excel
121
+
122
+ with WBClient(cookies="x_wbaas_token=...", proxy="http://user:pass@ip:port") as wb:
123
+ rank = wb.check_rank(141217830, "кроссовки sb dunk", max_pages=3)
124
+ print(f"Position: #{rank.position} (Page {rank.page}, Delta: {rank.rank_delta})")
125
+ rank_results_to_excel([rank], "result/ranks.xlsx")
126
+ ```
127
+
128
+ ### 4. Smart Review Summary (`wb_parser.reviews`)
129
+
130
+ ```python
131
+ from wb_parser import WBClient
132
+
133
+ with WBClient() as wb:
134
+ summary = wb.analyze_reviews(141217830, only_this_color=True, limit=100)
135
+ print("Size fit:", summary.size_fit)
136
+ print("Pros:", summary.top_pros)
137
+ print("Cons:", summary.top_cons)
138
+
139
+ # Optional OpenAI / DeepSeek / ProxyAPI summarization:
140
+ # summary = wb.analyze_reviews(141217830, ai_key="sk-...", ai_base_url="https://api.openai.com/v1")
141
+ ```
142
+
143
+ ---
144
+
145
+ ## 🖥️ Desktop GUI (`WB SDK Pro` — 7 Tabs)
146
+
147
+ ```bash
148
+ uv run wb-gui
149
+ # or
150
+ uv run python run_gui.py
151
+ ```
152
+
153
+ 1. **🔍 Парсер**: Scrape product links, `nm_id` articles, `/seller/...` stores, or search queries with price/discount/rating/keyword filters and 24/7 monitoring.
154
+ 2. **📦 Каталог товаров**: Live cards displaying price, `💳 WB Wallet` price, discount badge, price drop alert (`📉`), clickable *"Открыть на WB ↗"*, and 1-click export to **Excel `.xlsx`**, **CSV**, and **JSON**.
155
+ 3. **📈 Позиции (Rank)**: Paste `nm_id : keyword` pairs, scan Top 100–500+, see position movement (`▲`/`▼`), and export rank reports to Excel.
156
+ 4. **💬 Умные отзывы**: Enter any WB URL or `nm_id` to extract buyer reviews, rating histogram, size fit stats, and side-by-side **✅ Pros** & **❌ Cons** (instant offline mode OR optional LLM API).
157
+ 5. **🌐 Прокси и Сессия**: Choose delivery region (`dest`), configure HTTP/SOCKS5 proxy, rotation URL, `x_wbaas_token` cookie, and ping CDN + live WB Wallet discount rates in 1 click.
158
+ 6. **✈️ Telegram**: Forward product cards & alerts via a decoupled Telegram proxy.
159
+ 7. **📋 Журнал**: Live execution log.
160
+
161
+ ---
162
+
163
+ ## 💻 CLI Commands (`wb-parser`)
164
+
165
+ ```bash
166
+ # 1. Sync live CDN shards (01..65+) and check WB Wallet discount %
167
+ uv run wb-parser upstreams
168
+
169
+ # 2. Fetch product card (CDN card.json + feedbacks1/2 + .webp links) & save Excel
170
+ uv run wb-parser card https://www.wildberries.ru/catalog/141217830/detail.aspx -o item.xlsx
171
+
172
+ # 3. Calculate exact live WB Wallet discounted price
173
+ uv run wb-parser wallet 4990
174
+
175
+ # 4. Run Smart Review Analyzer (works directly without proxy or AI key!)
176
+ uv run wb-parser reviews 141217830 --limit 60
177
+
178
+ # 5. Track product search rank across pages
179
+ uv run wb-parser rank 141217830 "кроссовки dunk" --pages 3 -o ranks.xlsx
180
+
181
+ # 6. Check sharded feedbacks directly
182
+ uv run wb-parser feedbacks 181851928
183
+
184
+ # 7. View SQLite price drops
185
+ uv run wb-parser drops --db wb_prices.db
186
+ ```
187
+
188
+ ---
189
+
190
+ ## 🤖 Native MCP Server (`wb-mcp` — 8 Tools)
191
+
192
+ ```json
193
+ {
194
+ "mcpServers": {
195
+ "wildberries": {
196
+ "command": "uvx",
197
+ "args": ["--from", "wb-sdk-pro", "wb-mcp"]
198
+ }
199
+ }
200
+ }
201
+ ```
202
+
203
+ Available tools: `wb_get_card`, `wb_get_feedbacks`, `wb_search`, `wb_get_seller_catalog`, `wb_price_drops`, `wb_wallet_price`, `wb_check_rank`, `wb_smart_reviews`.
204
+
205
+ ---
206
+
207
+ ## 🧪 Tests (`pytest`)
208
+
209
+ ```bash
210
+ uv run pytest
211
+ ```
212
+
213
+ **24 tests passing** covering shard math, models, sync/async clients, WB Wallet rounding & thresholds, multi-page rank tracking & history deltas, smart review color filtering & pros/cons extraction, Excel exports, MCP tools, CLI, and GUI config persistence.
214
+
215
+ ## 📄 License
216
+
217
+ MIT License.
@@ -0,0 +1,183 @@
1
+ <h1 align="center">WB SDK Pro (`wb-sdk-pro`)</h1>
2
+ <p align="center">
3
+ <b>All-in-One Wildberries Suite: Catalog Parser + WB Wallet Pricing + Search Rank Tracker + Smart Review Analyzer + Desktop GUI &amp; MCP Server</b>
4
+ </p>
5
+
6
+ <p align="center">
7
+ <b>🇬🇧 English</b> •
8
+ <a href="https://github.com/eminsk/wildberries_parser/blob/master/README_RU.md">🇷🇺 Документация на русском</a>
9
+ </p>
10
+
11
+ [![PyPI Version](https://img.shields.io/pypi/v/wb-sdk-pro.svg?style=flat&logo=pypi&color=blue)](https://pypi.org/project/wb-sdk-pro/)
12
+ [![Release](https://img.shields.io/badge/release-v2.1.1-7c3aed.svg?style=flat&logo=github)](https://github.com/eminsk/wildberries_parser/releases/tag/v2.1.1)
13
+ [![Python Versions](https://img.shields.io/badge/python-3.10%20--%203.13+-3776AB.svg?style=flat&logo=python&logoColor=white)](https://www.python.org/)
14
+ [![uv Powered](https://img.shields.io/badge/uv-package%20manager-DE5FE9.svg?style=flat)](https://github.com/astral-sh/uv)
15
+ [![Tests](https://img.shields.io/badge/pytest-24%20passed-2ea44f.svg?style=flat&logo=pytest&logoColor=white)](https://github.com/eminsk/wildberries_parser/tree/master/tests)
16
+ [![Desktop GUI](https://img.shields.io/badge/Desktop%20GUI-7%20Tabs%20%7C%20CustomTkinter-blueviolet.svg?style=flat)](https://github.com/eminsk/wildberries_parser#desktop-gui)
17
+ [![MCP Server](https://img.shields.io/badge/MCP-8%20Tools%20JSON--RPC%202.0-00C853.svg?style=flat)](https://github.com/eminsk/wildberries_parser#mcp-server-for-ai-agents)
18
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat)](https://opensource.org/licenses/MIT)
19
+
20
+ > **Unified 3-in-1 Wildberries Architecture** upgrading and merging `wildberries_parser` + `wb_rank` + `wb_smart_review` into one modular, type-safe SDK, Desktop App, CLI, and MCP Server.
21
+
22
+ ---
23
+
24
+ ## 🚀 Unified Modules & Features
25
+
26
+ | Module | What It Solves | Highlights |
27
+ |---|---|---|
28
+ | **Catalog & CDN Engine** (`wb_parser.shards`, `client`) | Broken `basket-15` caps, 404 `.jpg` links & Issue #2 (`feedbacks1/2`) | Dynamic live sync (`basket-01..65+`, articles up to `2.88B+`), real `.webp` URLs, `root_id % 100 >= 50` feedback routing, direct `card.json` without WBAAS blocks |
29
+ | **WB Wallet Pricing** (`wb_parser.wallet`) | Calculating real buyer checkout price with `WB Кошелёк` / `ВБ Клуб` | Fetches live `default-payment.json` + `settings-front.json` thresholds (`wlt1DiscountDisplayMaxPrice`), floors prices via `ROUND_FLOOR` |
30
+ | **Search Rank Tracker** (`wb_parser.rank`) | Monitoring keyword positions across WB search (`wb_rank`) | Scans pages `1..N` (Top 100–500+), saves SQLite history, calculates position deltas (`▲ +5` / `▼ -3`), exports styled Excel `.xlsx` |
31
+ | **Smart Review Analyzer** (`wb_parser.reviews`) | Extracting buyer pros, cons & size fit (`wb_smart_review`) | Filters reviews by exact `nm_id` color or whole `root_id`, runs **instant Zero-API offline pros/cons/size analysis** OR optional OpenAI-compatible LLM summary |
32
+ | **Desktop GUI (`wb-gui`)** | Visual control center without touching terminal | Dark `CustomTkinter` UI with 7 tabs (Parser, Catalog Feed, Rank Tracker, Smart Reviews, Proxy & Session, Telegram, Logs) |
33
+ | **Native MCP Server (`wb-mcp`)** | Giving AI agents live Wildberries market intelligence | 8 JSON-RPC 2.0 tools for Claude Desktop, Cursor, Windsurf, and Antigravity |
34
+
35
+ ---
36
+
37
+ ## 📦 Installation (`uv` / `pip`)
38
+
39
+ ```bash
40
+ # Using uv (recommended)
41
+ uv add wb-sdk-pro
42
+
43
+ # Or run GUI / CLI ephemerally via uvx
44
+ uvx --from wb-sdk-pro wb-gui
45
+
46
+ # Or via pip
47
+ pip install wb-sdk-pro
48
+ ```
49
+
50
+ From source:
51
+ ```bash
52
+ git clone https://github.com/eminsk/wildberries_parser.git
53
+ cd wildberries_parser
54
+ uv sync
55
+ ```
56
+
57
+ ---
58
+
59
+ ## ⚡ Quick Start — Python Library
60
+
61
+ ### 1. Card Inspection, Sharded Feedbacks & Excel Export
62
+
63
+ ```python
64
+ from wb_parser import WBClient, to_excel
65
+
66
+ with WBClient(tracker_db="wb_prices.db") as wb:
67
+ wb.sync_upstreams()
68
+ item = wb.get_product("https://www.wildberries.ru/catalog/141217830/detail.aspx")
69
+ print(item.name, item.brand, f"Reviews: {item.feedback_count} (★ {item.valuation})")
70
+ to_excel([item], "result/wb_catalog.xlsx")
71
+ ```
72
+
73
+ ### 2. WB Wallet Discount Price (`wb_parser.wallet`)
74
+
75
+ ```python
76
+ from wb_parser import WBClient
77
+
78
+ with WBClient() as wb:
79
+ res = wb.wallet_price(4990)
80
+ print(f"Base: {res.base_price} ₽ -> With WB Wallet (-{res.discount_pct}%): {res.wallet_price} ₽")
81
+ ```
82
+
83
+ ### 3. Search Rank Tracking (`wb_parser.rank`)
84
+
85
+ ```python
86
+ from wb_parser import WBClient, rank_results_to_excel
87
+
88
+ with WBClient(cookies="x_wbaas_token=...", proxy="http://user:pass@ip:port") as wb:
89
+ rank = wb.check_rank(141217830, "кроссовки sb dunk", max_pages=3)
90
+ print(f"Position: #{rank.position} (Page {rank.page}, Delta: {rank.rank_delta})")
91
+ rank_results_to_excel([rank], "result/ranks.xlsx")
92
+ ```
93
+
94
+ ### 4. Smart Review Summary (`wb_parser.reviews`)
95
+
96
+ ```python
97
+ from wb_parser import WBClient
98
+
99
+ with WBClient() as wb:
100
+ summary = wb.analyze_reviews(141217830, only_this_color=True, limit=100)
101
+ print("Size fit:", summary.size_fit)
102
+ print("Pros:", summary.top_pros)
103
+ print("Cons:", summary.top_cons)
104
+
105
+ # Optional OpenAI / DeepSeek / ProxyAPI summarization:
106
+ # summary = wb.analyze_reviews(141217830, ai_key="sk-...", ai_base_url="https://api.openai.com/v1")
107
+ ```
108
+
109
+ ---
110
+
111
+ ## 🖥️ Desktop GUI (`WB SDK Pro` — 7 Tabs)
112
+
113
+ ```bash
114
+ uv run wb-gui
115
+ # or
116
+ uv run python run_gui.py
117
+ ```
118
+
119
+ 1. **🔍 Парсер**: Scrape product links, `nm_id` articles, `/seller/...` stores, or search queries with price/discount/rating/keyword filters and 24/7 monitoring.
120
+ 2. **📦 Каталог товаров**: Live cards displaying price, `💳 WB Wallet` price, discount badge, price drop alert (`📉`), clickable *"Открыть на WB ↗"*, and 1-click export to **Excel `.xlsx`**, **CSV**, and **JSON**.
121
+ 3. **📈 Позиции (Rank)**: Paste `nm_id : keyword` pairs, scan Top 100–500+, see position movement (`▲`/`▼`), and export rank reports to Excel.
122
+ 4. **💬 Умные отзывы**: Enter any WB URL or `nm_id` to extract buyer reviews, rating histogram, size fit stats, and side-by-side **✅ Pros** & **❌ Cons** (instant offline mode OR optional LLM API).
123
+ 5. **🌐 Прокси и Сессия**: Choose delivery region (`dest`), configure HTTP/SOCKS5 proxy, rotation URL, `x_wbaas_token` cookie, and ping CDN + live WB Wallet discount rates in 1 click.
124
+ 6. **✈️ Telegram**: Forward product cards & alerts via a decoupled Telegram proxy.
125
+ 7. **📋 Журнал**: Live execution log.
126
+
127
+ ---
128
+
129
+ ## 💻 CLI Commands (`wb-parser`)
130
+
131
+ ```bash
132
+ # 1. Sync live CDN shards (01..65+) and check WB Wallet discount %
133
+ uv run wb-parser upstreams
134
+
135
+ # 2. Fetch product card (CDN card.json + feedbacks1/2 + .webp links) & save Excel
136
+ uv run wb-parser card https://www.wildberries.ru/catalog/141217830/detail.aspx -o item.xlsx
137
+
138
+ # 3. Calculate exact live WB Wallet discounted price
139
+ uv run wb-parser wallet 4990
140
+
141
+ # 4. Run Smart Review Analyzer (works directly without proxy or AI key!)
142
+ uv run wb-parser reviews 141217830 --limit 60
143
+
144
+ # 5. Track product search rank across pages
145
+ uv run wb-parser rank 141217830 "кроссовки dunk" --pages 3 -o ranks.xlsx
146
+
147
+ # 6. Check sharded feedbacks directly
148
+ uv run wb-parser feedbacks 181851928
149
+
150
+ # 7. View SQLite price drops
151
+ uv run wb-parser drops --db wb_prices.db
152
+ ```
153
+
154
+ ---
155
+
156
+ ## 🤖 Native MCP Server (`wb-mcp` — 8 Tools)
157
+
158
+ ```json
159
+ {
160
+ "mcpServers": {
161
+ "wildberries": {
162
+ "command": "uvx",
163
+ "args": ["--from", "wb-sdk-pro", "wb-mcp"]
164
+ }
165
+ }
166
+ }
167
+ ```
168
+
169
+ Available tools: `wb_get_card`, `wb_get_feedbacks`, `wb_search`, `wb_get_seller_catalog`, `wb_price_drops`, `wb_wallet_price`, `wb_check_rank`, `wb_smart_reviews`.
170
+
171
+ ---
172
+
173
+ ## 🧪 Tests (`pytest`)
174
+
175
+ ```bash
176
+ uv run pytest
177
+ ```
178
+
179
+ **24 tests passing** covering shard math, models, sync/async clients, WB Wallet rounding & thresholds, multi-page rank tracking & history deltas, smart review color filtering & pros/cons extraction, Excel exports, MCP tools, CLI, and GUI config persistence.
180
+
181
+ ## 📄 License
182
+
183
+ MIT License.
@@ -0,0 +1,107 @@
1
+ <h1 align="center">WB SDK Pro (`wb-sdk-pro`)</h1>
2
+ <p align="center">
3
+ <b>Единая экосистема для Wildberries: Парсер + WB Кошелёк + Позиции в поиске (Rank) + Умные отзывы + Desktop GUI + MCP-сервер</b>
4
+ </p>
5
+
6
+ <p align="center">
7
+ <a href="https://github.com/eminsk/wildberries_parser/blob/master/README.md">🇬🇧 English</a> •
8
+ <b>🇷🇺 Документация на русском</b>
9
+ </p>
10
+
11
+ > Современное объединение и глубокий рефакторинг трёх проектов (`wildberries_parser` + `wb_rank` + `wb_smart_review`) в единую модульную библиотеку на Python (`uv add wb-sdk-pro`), 7-вкладочный тёмный Desktop GUI, CLI и нативный MCP-сервер.
12
+
13
+ ---
14
+
15
+ ## 🚀 Что объединено в одном проекте (`v2.1.1`)
16
+
17
+ 1. **Ядро парсера и CDN-роутер (`shards.py`, `client.py`, `http.py`):**
18
+ - Исправлена маршрутизация отзывов **`feedbacks1` / `feedbacks2`** по точной формуле `root_id % 100 >= 50` (решение Issue #2).
19
+ - Поддержка **всех 65+ корзин (`basket-01..65+`)** и живая синхронизация карты с `https://cdn.wbbasket.ru/api/v3/upstreams`.
20
+ - Актуальные фото **`.webp`** на `wbbasket.ru` и прямой сбор карточек из CDN `card.json` **без банов WBAAS 498 и без прокси**.
21
+ - Эмуляция TLS Chrome (`curl_cffi`), принудительный IPv4 и сброс сессии при таймаутах CDN.
22
+
23
+ 2. **Калькулятор цены с WB Кошельком (`wallet.py`, из `wb_rank`):**
24
+ - Забирает актуальные ставки из `default-payment.json` («Незалогиненный кошелёк» и «ВБ Клуб») и лимиты из `settings-front.json` (`wlt1DiscountDisplayMaxPrice`) с резервным зеркалом `geobasket`.
25
+ - Автоматически добавляет `Цена с WB Кошельком (₽)` в карточки, Excel и Telegram-уведомления.
26
+
27
+ 3. **Мониторинг позиций в поиске (`rank.py`, из `wb_rank`):**
28
+ - Сканирует страницы поиска `1..N` (Топ 100–500+ выдачи), вычисляет сквозную позицию и страницу.
29
+ - Сохраняет историю позиций в SQLite и показывает динамику (`▲ +5` / `▼ -3`).
30
+ - Выгружает отчёты по позициям в стильный Excel (`.xlsx`).
31
+
32
+ 4. **Умные отзывы (`reviews.py`, из `wb_smart_review`):**
33
+ - Автоматически переводит `nm_id` $\rightarrow$ `root_id` через CDN `card.json` (без падений на `card.wb.ru`) и забирает реальные отзывы покупателей с `feedbacks1/2`.
34
+ - Фильтрует отзывы строго по выбранному цвету (`nm_id`) или по всей карточке (`root_id`).
35
+ - **Два режима сводки:** встроенный быстрый **оффлайн-анализатор** (без API-ключей — сразу выделяет плюсы, минусы и соответствие размера *«в размер / маломерит»*) и опциональный **OpenAI-совместимый LLM** (OpenAI, DeepSeek, ProxyAPI).
36
+
37
+ ---
38
+
39
+ ## 📦 Установка (`uv` / `pip`)
40
+
41
+ ```bash
42
+ # Через uv (рекомендуется)
43
+ uv add wb-sdk-pro
44
+
45
+ # Мгновенный запуск GUI без установки в проект
46
+ uvx --from wb-sdk-pro wb-gui
47
+
48
+ # Или через pip
49
+ pip install wb-sdk-pro
50
+ ```
51
+
52
+ Из исходников:
53
+ ```bash
54
+ git clone https://github.com/eminsk/wildberries_parser.git
55
+ cd wildberries_parser
56
+ uv sync
57
+ ```
58
+
59
+ ---
60
+
61
+ ## 🖥️ Графический интерфейс (Desktop GUI — 7 вкладок)
62
+
63
+ ```bash
64
+ uv run wb-gui
65
+ # или
66
+ uv run python run_gui.py
67
+ ```
68
+
69
+ * **🔍 Парсер:** ссылки на товары, артикулы, продавцы (`/seller/...`), поиск, фильтры цен/скидок/рейтинга/ключевых слов, мониторинг 24/7.
70
+ * **📦 Каталог товаров:** живые карточки с ценами, ценой по WB Кошельку (`💳`), скидками и экспортом в **Excel `.xlsx`**, CSV и JSON.
71
+ * **📈 Позиции (Rank):** пакетная проверка пар `артикул : запрос`, история динамики (`▲`/`▼`), экспорт в Excel.
72
+ * **💬 Умные отзывы:** мгновенная выжимка плюсов (**✅**) и минусов (**❌**), анализ размерности и лента реальных отзывов (работает без прокси и без API-ключа).
73
+ * **🌐 Прокси и Сессия:** выбор региона (`dest`), прокси HTTP/SOCKS5, URL смены IP, `x_wbaas_token` cookie, кнопка проверки пинга и живых ставок WB Кошелька.
74
+ * **✈️ Telegram & 📋 Журнал:** алерты через отдельный прокси для Telegram и живые логи.
75
+
76
+ ---
77
+
78
+ ## 💻 Быстрые команды CLI (`wb-parser`)
79
+
80
+ ```bash
81
+ # Проверка CDN-корзин и текущих ставок WB Кошелька
82
+ uv run wb-parser upstreams
83
+
84
+ # Расчёт цены с WB Кошельком
85
+ uv run wb-parser wallet 4990
86
+
87
+ # Полная карточка товара + отзывы + экспорт в Excel
88
+ uv run wb-parser card https://www.wildberries.ru/catalog/141217830/detail.aspx -o item.xlsx
89
+
90
+ # Умный разбор отзывов товара (плюсы / минусы / размерность)
91
+ uv run wb-parser reviews 141217830 --limit 60
92
+
93
+ # Проверка позиции товара по поисковому запросу
94
+ uv run wb-parser rank 141217830 "кроссовки dunk" --pages 3 -o ranks.xlsx
95
+
96
+ # Запуск MCP-сервера для ИИ-агентов (8 инструментов)
97
+ uv run wb-mcp
98
+ ```
99
+
100
+ ---
101
+
102
+ ## 🧪 Автотесты (`pytest`)
103
+
104
+ ```bash
105
+ uv run pytest
106
+ ```
107
+ *(Все **24 теста** пройдены успешно).*
@@ -0,0 +1,29 @@
1
+ """
2
+ Basic SDK usage example showing direct CDN card fetch, sharded feedbacks, and Excel export.
3
+ Run: uv run python examples/basic_usage.py
4
+ """
5
+
6
+ from wb_parser import WBClient, calculate_feedback_shard, to_excel
7
+
8
+
9
+ def main() -> None:
10
+ with WBClient(tracker_db="wb_prices.db") as client:
11
+ # 1. Sync live basket-01..65+ shard ranges from cdn.wbbasket.ru
12
+ count = client.sync_upstreams()
13
+ print(f"Loaded {count} live WB basket shard routes.")
14
+
15
+ # 2. Fetch product directly from wbbasket.ru CDN + sharded feedbacks1/2
16
+ product = client.get_product("https://www.wildberries.ru/catalog/141217830/detail.aspx")
17
+ shard = calculate_feedback_shard(product.root)
18
+ print(f"Product: {product.name}")
19
+ print(f"Root ID: {product.root} -> feedbacks{shard}.wb.ru")
20
+ print(f"Reviews: {product.feedback_count} (rating {product.valuation})")
21
+ print(f"Photos (.webp): {len(product.image_links)}")
22
+
23
+ # 3. Export styled spreadsheet
24
+ out = to_excel([product], "result/demo_wb.xlsx")
25
+ print(f"Saved Excel report to {out}")
26
+
27
+
28
+ if __name__ == "__main__":
29
+ main()
@@ -0,0 +1,20 @@
1
+ """
2
+ Backward-compatible model exports matching original `models.py`.
3
+ """
4
+
5
+ import sys
6
+ from pathlib import Path
7
+
8
+ SRC = Path(__file__).resolve().parent / "src"
9
+ if str(SRC) not in sys.path:
10
+ sys.path.insert(0, str(SRC))
11
+
12
+ from wb_parser.models import ( # noqa: E402, F401
13
+ Feedback,
14
+ FeedbackInfo,
15
+ Item,
16
+ Items,
17
+ PriceRecord,
18
+ WBProduct,
19
+ WBSearchPage,
20
+ )
@@ -0,0 +1,19 @@
1
+ """
2
+ Backward-compatible root entrypoint for `Duff89/wildberries_parser`.
3
+ Allows running `python parser.py` or `from parser import ParseWB`.
4
+ """
5
+
6
+ import sys
7
+ from pathlib import Path
8
+
9
+ SRC = Path(__file__).resolve().parent / "src"
10
+ if str(SRC) not in sys.path:
11
+ sys.path.insert(0, str(SRC))
12
+
13
+ from wb_parser import AsyncWBClient, ParseWB, WBClient # noqa: E402, F401
14
+
15
+ if __name__ == "__main__":
16
+ target = sys.argv[1] if len(sys.argv) > 1 else "https://www.wildberries.ru/catalog/141217830/detail.aspx"
17
+ out = sys.argv[2] if len(sys.argv) > 2 else "wb_data.xlsx"
18
+ print(f"Fetching WB target via WB SDK Pro: {target} -> {out}")
19
+ ParseWB(target, output_path=out).parse()