redfox-python-sdk 0.2.1__tar.gz → 0.3.0__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 (44) hide show
  1. redfox_python_sdk-0.3.0/PKG-INFO +672 -0
  2. redfox_python_sdk-0.3.0/README.md +648 -0
  3. redfox_python_sdk-0.3.0/redfox/__init__.py +13 -0
  4. redfox_python_sdk-0.3.0/redfox/client.py +572 -0
  5. {redfox-python-sdk-0.2.1 → redfox_python_sdk-0.3.0}/redfox/endpoints/ai_search.py +73 -1
  6. redfox_python_sdk-0.3.0/redfox/endpoints/autohome.py +77 -0
  7. {redfox-python-sdk-0.2.1 → redfox_python_sdk-0.3.0}/redfox/endpoints/bilibili.py +35 -0
  8. redfox_python_sdk-0.3.0/redfox/endpoints/dongchedi.py +74 -0
  9. redfox_python_sdk-0.3.0/redfox/endpoints/douyin.py +371 -0
  10. redfox_python_sdk-0.3.0/redfox/endpoints/hotspot.py +81 -0
  11. redfox_python_sdk-0.3.0/redfox/endpoints/instagram.py +83 -0
  12. redfox_python_sdk-0.3.0/redfox/endpoints/kuaishou.py +126 -0
  13. redfox_python_sdk-0.3.0/redfox/endpoints/tiktok.py +88 -0
  14. redfox_python_sdk-0.3.0/redfox/endpoints/tools.py +157 -0
  15. redfox_python_sdk-0.3.0/redfox/endpoints/toutiao.py +88 -0
  16. redfox_python_sdk-0.3.0/redfox/endpoints/twitter.py +84 -0
  17. redfox_python_sdk-0.3.0/redfox/endpoints/wechat.py +337 -0
  18. redfox_python_sdk-0.3.0/redfox/endpoints/wechat_channels.py +123 -0
  19. redfox_python_sdk-0.3.0/redfox/endpoints/xiaohongshu.py +332 -0
  20. redfox_python_sdk-0.3.0/redfox/endpoints/yiche.py +83 -0
  21. redfox_python_sdk-0.3.0/redfox/endpoints/youtube.py +101 -0
  22. redfox_python_sdk-0.3.0/redfox_python_sdk.egg-info/PKG-INFO +672 -0
  23. {redfox-python-sdk-0.2.1 → redfox_python_sdk-0.3.0}/redfox_python_sdk.egg-info/SOURCES.txt +10 -0
  24. redfox_python_sdk-0.3.0/redfox_python_sdk.egg-info/requires.txt +1 -0
  25. {redfox-python-sdk-0.2.1 → redfox_python_sdk-0.3.0}/setup.py +3 -3
  26. redfox-python-sdk-0.2.1/PKG-INFO +0 -48
  27. redfox-python-sdk-0.2.1/README.md +0 -30
  28. redfox-python-sdk-0.2.1/redfox/__init__.py +0 -7
  29. redfox-python-sdk-0.2.1/redfox/client.py +0 -162
  30. redfox-python-sdk-0.2.1/redfox/endpoints/douyin.py +0 -164
  31. redfox-python-sdk-0.2.1/redfox/endpoints/tiktok.py +0 -33
  32. redfox-python-sdk-0.2.1/redfox/endpoints/toutiao.py +0 -40
  33. redfox-python-sdk-0.2.1/redfox/endpoints/wechat.py +0 -159
  34. redfox-python-sdk-0.2.1/redfox/endpoints/xiaohongshu.py +0 -143
  35. redfox-python-sdk-0.2.1/redfox_python_sdk.egg-info/PKG-INFO +0 -48
  36. redfox-python-sdk-0.2.1/redfox_python_sdk.egg-info/requires.txt +0 -1
  37. {redfox-python-sdk-0.2.1 → redfox_python_sdk-0.3.0}/redfox/endpoints/__init__.py +0 -0
  38. {redfox-python-sdk-0.2.1 → redfox_python_sdk-0.3.0}/redfox/endpoints/doubao_image.py +0 -0
  39. {redfox-python-sdk-0.2.1 → redfox_python_sdk-0.3.0}/redfox/endpoints/doubao_video.py +0 -0
  40. {redfox-python-sdk-0.2.1 → redfox_python_sdk-0.3.0}/redfox/endpoints/gpt_image.py +0 -0
  41. {redfox-python-sdk-0.2.1 → redfox_python_sdk-0.3.0}/redfox/exceptions.py +0 -0
  42. {redfox-python-sdk-0.2.1 → redfox_python_sdk-0.3.0}/redfox_python_sdk.egg-info/dependency_links.txt +0 -0
  43. {redfox-python-sdk-0.2.1 → redfox_python_sdk-0.3.0}/redfox_python_sdk.egg-info/top_level.txt +0 -0
  44. {redfox-python-sdk-0.2.1 → redfox_python_sdk-0.3.0}/setup.cfg +0 -0
@@ -0,0 +1,672 @@
1
+ Metadata-Version: 2.4
2
+ Name: redfox-python-sdk
3
+ Version: 0.3.0
4
+ Summary: RedFox 红狐数据平台 Python SDK — 同步+异步双客户端,自动重试,零配置
5
+ Home-page: https://redfox.hk
6
+ Author: RedFox
7
+ Author-email: dev@redfox.hk
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Programming Language :: Python :: 3
12
+ Requires-Python: >=3.8
13
+ Description-Content-Type: text/markdown
14
+ Requires-Dist: httpx>=0.25.0
15
+ Dynamic: author
16
+ Dynamic: author-email
17
+ Dynamic: classifier
18
+ Dynamic: description
19
+ Dynamic: description-content-type
20
+ Dynamic: home-page
21
+ Dynamic: requires-dist
22
+ Dynamic: requires-python
23
+ Dynamic: summary
24
+
25
+ # RedFox Python SDK
26
+
27
+ <div align="center">
28
+ <a href="https://pypi.org/project/redfox-python-sdk/"><img src="https://img.shields.io/pypi/v/redfox-python-sdk.svg" alt="PyPI version"></a> <a href="https://pypi.org/project/redfox-python-sdk/"><img src="https://img.shields.io/pypi/pyversions/redfox-python-sdk.svg" alt="Python"></a> <a href="https://pypi.org/project/redfox-python-sdk/"><img src="https://img.shields.io/pypi/l/redfox-python-sdk.svg" alt="License"></a>
29
+
30
+ <strong>中文</strong> | <a href="https://github.com/redfox-data/redfox-python-sdk/blob/main/README.en.md">English</a> | <a href="https://github.com/redfox-data/redfox-python-sdk/blob/main/README.ko.md">한국어</a> | <a href="https://github.com/redfox-data/redfox-python-sdk/blob/main/README.ja.md">日本語</a> | <a href="https://github.com/redfox-data/redfox-python-sdk/blob/main/README.fr.md">Français</a>
31
+
32
+ </div>
33
+ <p align="center">
34
+ <a href="https://redfox.hk/?source=github">
35
+ <img src="https://lyy.redfox.hk/page/redfox-page-3.png" alt="RedFox Logo" width="100%">
36
+ </a>
37
+ </p>
38
+
39
+ [RedFoxHub](https://redfox.hk/?source=github) Python SDK,提供 [抖音](https://redfox.hk/apis/douyin/0OT1E306)、[小红书](https://redfox.hk/apis/xiaohongshu/4IVIDHEN)、[公众号](https://redfox.hk/apis/gongzhonghao/6C4A77XR)、[B站](https://redfox.hk/apis/bilibili/TIN1NMTZ)、[今日头条](https://redfox.hk/apis/jinritoutiao/28CFGF5I)、[TikTok](https://redfox.hk/apis/tool-tiktok/20070019)、快手、视频号、YouTube、X (Twitter)、Instagram、懂车帝、易车、汽车之家 14 大内容平台的数据采集接口,多平台热点榜单聚合接口,短视频去水印下载与素材上传工具,以及 GPT 图片生成、豆包图片/视频生成、AI 搜索(Kimi/豆包/Deepseek/元宝/千问/百度)AI 能力接口。
40
+
41
+ ## 为什么选择 RedFoxHub
42
+
43
+ <p align="center"><em>平台数据限时统一定价,最低可至 <strong style="color:#e53e3e">¥0.02/次</strong></em></p>
44
+
45
+ <table align="center">
46
+ <tr>
47
+ <td align="center" width="25%">
48
+ <b>⚡ 极速响应</b><br>
49
+ <sub>毫秒级 API 响应,全球 CDN 加速,让您的应用快如闪电</sub>
50
+ </td>
51
+ <td align="center" width="25%">
52
+ <b>🛡️ 安全可靠</b><br>
53
+ <sub>企业级安全防护,数据加密传输,99.99% 可用性保证</sub>
54
+ </td>
55
+ <td align="center" width="25%">
56
+ <b>🌍 全球覆盖</b><br>
57
+ <sub>支持全球主流新媒体平台,一键接入多平台数据</sub>
58
+ </td>
59
+ <td align="center" width="25%">
60
+ <b>💎 弹性计费</b><br>
61
+ <sub>按需付费,无隐藏费用,灵活的套餐满足不同需求</sub>
62
+ </td>
63
+ </tr>
64
+ </table>
65
+
66
+ ## SDK 核心特性
67
+
68
+ - **零配置** — 设置环境变量 `REDFOX_API_KEY` 即可使用,无需配置对象,扁平化参数
69
+ - **指数退避自动重试** — 网络超时、服务端 5xx、限流 429 自动重试(含随机抖动防惊群)
70
+ - **同步 + 异步双客户端** — `RedFoxClient` 与 `AsyncRedFoxClient`,API 完全一致
71
+ - **文件上传** — 内置 multipart 上传,支持文件路径 / bytes / 文件对象
72
+ - **结构化异常** — `RedFoxAuthError` / `RedFoxRateLimitError` / `RedFoxAPIError`,含完整调试上下文
73
+ - **生产就绪** — 基于 `httpx` 构建,支持连接复用、超时控制、上下文管理器
74
+
75
+ ## 安装
76
+
77
+ ```bash
78
+ pip install redfox-python-sdk
79
+ ```
80
+
81
+ ## 身份认证
82
+
83
+ ### 获取 API Key
84
+
85
+ 1. 前往 [https://redfox.hk/settings/api-keys?source=github](https://redfox.hk/settings/api-keys?source=github) 注册 / 登录。
86
+ 2. 在控制台复制你的 API Key。
87
+ 3. 设置为环境变量或直接传入:
88
+
89
+ ```bash
90
+ export REDFOX_API_KEY="YOUR_API_KEY"
91
+ ```
92
+
93
+ ## 多平台API文档
94
+
95
+ <p align="center">
96
+ <a href="https://redfox.hk/apis?source=github">
97
+ <img src="https://lyy.redfox.hk/page/redfox-page-1.png" alt="RedFox Logo" width="100%">
98
+ </a>
99
+ </p>
100
+
101
+ ### API文档中包含:
102
+
103
+ - 请求头说明
104
+ - 请求参数说明
105
+ - 返回值和数据结构说明
106
+ - 请求示例
107
+ - 响应示例
108
+ - 常见状态码说明
109
+
110
+ ## 快速开始
111
+
112
+ ```python
113
+ from redfox import RedFoxClient
114
+
115
+ client = RedFoxClient(api_key="your_api_key")
116
+
117
+ # 搜索抖音作品
118
+ result = client.douyin.search_articles(keyword="AI")
119
+
120
+ # 搜索小红书笔记
121
+ result = client.xiaohongshu.search_articles(keyword="旅行")
122
+
123
+ # 搜索公众号文章
124
+ result = client.wechat.search_articles(keyword="科技")
125
+
126
+ # 搜索快手作品
127
+ result = client.kuaishou.search_works(keyword="美食")
128
+
129
+ # 搜索 YouTube 视频
130
+ result = client.youtube.search_videos(search_query="AI tutorial")
131
+
132
+ # 全网聚合热点 TOP10
133
+ result = client.hotspot.get_top10(
134
+ start_date="2026-08-20 00:00:00",
135
+ end_date="2026-08-21 00:00:00",
136
+ )
137
+
138
+ # 短视频去水印下载
139
+ result = client.tools.download(url="https://www.douyin.com/video/xxx")
140
+
141
+ # AI 搜索
142
+ task = client.ai_search.kimi_submit(inquiry_text="2026年AI发展趋势")
143
+ result = client.ai_search.kimi_result(task_id=task["taskId"])
144
+ ```
145
+
146
+ ## 支持的平台
147
+
148
+ | 平台 | 模块 | 方法数 | 说明 |
149
+ |------|------|--------|------|
150
+ | 📱 抖音 | `client.douyin` | 16 | 作品/账号搜索(优质库+广域库)、账号信息、作品详情、AI作品搜索、热榜/飙升榜、热门账号、视频提文案 |
151
+ | 📕 小红书 | `client.xiaohongshu` | 15 | 笔记/账号搜索、账号信息、笔记详情、作品列表、AI笔记搜索、评论、日榜/周榜/黑马榜、热门账号、爆款洞察、视频提文案 |
152
+ | 💬 公众号 | `client.wechat` | 16 | 文章/账号搜索(优质库+广域库)、账号信息、文章详情、作品列表、AI文章搜索、10W+榜、原创榜、实力榜、阅读增长榜 |
153
+ | 📺 B站 | `client.bilibili` | 8 | 视频搜索、UP主搜索、UP主信息、UP主作品、视频详情、音频提取、视频提文案 |
154
+ | 📰 今日头条 | `client.toutiao` | 5 | 内容搜索、作品详情、作品评论、账号搜索、账号作品列表 |
155
+ | 🎵 TikTok | `client.tiktok` | 4 | 用户搜索、视频搜索、作品详情、用户作品列表 |
156
+ | 🎬 快手 | `client.kuaishou` | 6 | 作品搜索、作品详情、账号作品、账号搜索、视频提文案 |
157
+ | 💚 视频号 | `client.wechat_channels` | 7 | 作品搜索、作品详情、账号作品、链接实时详情、账号搜索、链接提文案 |
158
+ | ▶️ YouTube | `client.youtube` | 4 | 视频搜索、视频详情、视频评论、视频提文案(字幕提取) |
159
+ | 🐦 X (Twitter) | `client.twitter` | 4 | 推文搜索、推文详情、用户信息、推文评论 |
160
+ | 📸 Instagram | `client.instagram` | 4 | 综合搜索、帖子详情、帖子评论、用户信息 |
161
+ | 🚗 懂车帝 | `client.dongchedi` | 4 | 作品搜索、作品详情、用户作品、用户搜索 |
162
+ | 🚙 易车 | `client.yiche` | 5 | 作品搜索、文章详情、视频详情、账号作品、账号搜索 |
163
+ | 🚘 汽车之家 | `client.autohome` | 4 | 作品搜索、文章详情、视频详情、账号作品 |
164
+ | 🔥 热点榜单 | `client.hotspot` | 3 | 各平台热点榜、全网热搜查询、全网聚合热点 TOP10 |
165
+ | 🖼️ GPT 图片 | `client.gpt_image` | 2 | 图片生成、结果查询 |
166
+ | 🎨 豆包图片 | `client.doubao_image` | 4 | Pro/Lite 图片生成及查询 |
167
+ | 🎬 豆包视频 | `client.doubao_video` | 2 | 视频生成、结果查询 |
168
+ | 🔍 AI 搜索 | `client.ai_search` | 12 | Kimi/豆包/Deepseek/元宝/千问/百度 搜索 |
169
+ | 🛠️ 通用工具 | `client.tools` | 12 | 多平台短视频去水印下载、图片/素材上传 |
170
+
171
+ ## API 参考
172
+
173
+ ### 抖音
174
+
175
+ ```python
176
+ # 搜索抖音作品(优质库)
177
+ client.douyin.search_articles(keyword="AI", offset=0, sort_type="0")
178
+
179
+ # 搜索抖音用户(优质库)
180
+ client.douyin.search_users(keyword="科技", offset=0)
181
+
182
+ # 获取账号信息
183
+ client.douyin.get_user(account_id="nxpt260212")
184
+
185
+ # 获取账号作品列表
186
+ client.douyin.get_user_works(account_id="nxpt260212", offset=0)
187
+
188
+ # 获取作品详情(支持 work_id 或 work_url)
189
+ client.douyin.get_work(work_id="7654143095876898089")
190
+
191
+ # 搜索AI作品
192
+ client.douyin.search_ai_articles(keyword="AI", page_num=1, page_size=10)
193
+
194
+ # ─── 广域库(更大覆盖范围) ───
195
+ client.douyin.search_works_wide(keyword="AI", start_date="2026-08-01", end_date="2026-08-20")
196
+ client.douyin.search_accounts_wide(keyword="科技")
197
+ client.douyin.get_work_wide(video_id="7654143095876898089")
198
+ client.douyin.get_user_works_wide(unique_name="nxpt260212")
199
+
200
+ # ─── 榜单 ───
201
+ client.douyin.get_daily_hot_rank(type="美食") # 每日热门作品榜
202
+ client.douyin.get_daily_surge_rank(type="全部") # 每日点赞飙升榜
203
+ client.douyin.get_weekly_surge_rank(type="全部") # 七日点赞飙升榜
204
+ client.douyin.get_hot_accounts(date_type="days", rank_date="2026-08-20", type="全部")
205
+
206
+ # ─── 视频提文案 ───
207
+ task = client.douyin.transcript_submit(url="https://www.douyin.com/video/xxx")
208
+ result = client.douyin.transcript_result(task_id=task["taskId"])
209
+ ```
210
+
211
+ ### 小红书
212
+
213
+ ```python
214
+ # 搜索笔记
215
+ client.xiaohongshu.search_articles(keyword="旅行", offset=0, sort_type="0")
216
+
217
+ # 搜索博主
218
+ client.xiaohongshu.search_users(keyword="旅行", offset=0)
219
+
220
+ # 获取博主信息
221
+ client.xiaohongshu.get_account(account_id="5e1e4c8c0000000001023027")
222
+
223
+ # 获取笔记详情(支持 work_id 或 work_link)
224
+ client.xiaohongshu.get_work(work_id="6a2ac3020000000035022d8e")
225
+
226
+ # 获取博主作品列表
227
+ client.xiaohongshu.get_user_works(red_id="nxpt260212", offset=0)
228
+
229
+ # 搜索AI笔记
230
+ client.xiaohongshu.search_ai_articles(keyword="AI", page_num=1, page_size=10)
231
+
232
+ # ─── 评论 ───
233
+ task = client.xiaohongshu.comment_submit(opus_id="6a2ac3020000000035022d8e", data_num=-1)
234
+ result = client.xiaohongshu.comment_result(task_id=task["taskId"])
235
+
236
+ # ─── 榜单 / 洞察 ───
237
+ client.xiaohongshu.get_daily_hot_rank(rank_date="2026-08-20", category="综合全部")
238
+ client.xiaohongshu.get_weekly_hot_rank(rank_date="2026-08-20", category="综合全部")
239
+ client.xiaohongshu.get_hot_accounts(date_type=1, rank_date="2026-08-20", type="综合全部")
240
+ client.xiaohongshu.search_hot_notes(keyword="穿搭", start_date="2026-08-01", end_date="2026-08-20")
241
+ client.xiaohongshu.get_dark_horse_notes(keyword="AI,穿搭", start_date="2026-08-01")
242
+
243
+ # ─── 视频提文案 ───
244
+ task = client.xiaohongshu.transcript_submit(url="https://www.xiaohongshu.com/explore/xxx")
245
+ result = client.xiaohongshu.transcript_result(task_id=task["taskId"])
246
+ ```
247
+
248
+ ### 公众号
249
+
250
+ ```python
251
+ # 搜索文章
252
+ client.wechat.search_articles(keyword="AI", offset=0)
253
+
254
+ # 搜索账号
255
+ client.wechat.search_users(keyword="科技", offset=0)
256
+
257
+ # 获取账号信息
258
+ client.wechat.get_account(account="rmrbwx")
259
+
260
+ # 获取文章详情(支持全文内容)
261
+ client.wechat.get_article_detail(url="https://mp.weixin.qq.com/s/...")
262
+
263
+ # 获取文章元数据
264
+ client.wechat.get_work(work_uuid="3F4DE056583609162E0816FBE8C183A3")
265
+
266
+ # 获取账号文章列表
267
+ client.wechat.get_user_works(
268
+ account="rmrbwx", offset=0,
269
+ sort_type="_2",
270
+ publish_time_start="2026-07-01",
271
+ publish_time_end="2026-07-20"
272
+ )
273
+
274
+ # 搜索AI文章
275
+ client.wechat.search_ai_articles(keyword="AI", page_num=1, page_size=10)
276
+
277
+ # ─── 广域库(更大覆盖范围) ───
278
+ client.wechat.search_articles_wide(keyword="AI", offset=0)
279
+ client.wechat.search_users_wide(keyword="科技")
280
+ client.wechat.get_work_wide(work_uuid="3F4DE056583609162E0816FBE8C183A3")
281
+ client.wechat.get_user_works_wide(account="rmrbwx")
282
+ client.wechat.get_account_wide(wx_id="gh_5c7e8b7f586b")
283
+
284
+ # ─── 榜单 ───
285
+ client.wechat.get_ten_w_rank(type="科技数码", start_date="2026-08-19", end_date="2026-08-20")
286
+ client.wechat.get_original_rank(type="科技数码", start_date="2026-08-19", end_date="2026-08-20")
287
+ client.wechat.get_strength_rank(rank_type="day", rank_date="2026-08-20", category="科技数码")
288
+ client.wechat.get_reading_growth_rank(rank_date="2026-08-20")
289
+ ```
290
+
291
+ ### 视频号
292
+
293
+ ```python
294
+ # 搜索作品
295
+ client.wechat_channels.search_works(keyword="旅行", sort="综合", page=1, size=20)
296
+
297
+ # 获取作品详情
298
+ client.wechat_channels.get_work(video_id="export/UzFfAgtgekIEAQAAAAAAxx8")
299
+
300
+ # 获取账号作品列表(昵称精准匹配)
301
+ client.wechat_channels.get_user_works(nickname="央视新闻", page=1)
302
+
303
+ # 作品链接实时详情
304
+ client.wechat_channels.get_work_by_link(url="https://weixin.qq.com/sph/xxx")
305
+
306
+ # 搜索账号
307
+ client.wechat_channels.search_users(account_name="央视", page=1)
308
+
309
+ # 链接提文案
310
+ task = client.wechat_channels.transcript_submit(url="https://weixin.qq.com/sph/xxx")
311
+ result = client.wechat_channels.transcript_result(task_id=task["taskId"])
312
+ ```
313
+
314
+ ### B站
315
+
316
+ ```python
317
+ # 搜索视频
318
+ client.bilibili.search_articles(keyword="Python", page=1, page_size=10, order="time")
319
+
320
+ # 搜索UP主
321
+ client.bilibili.search_users(keyword="影视飓风", page=1, page_size=10, order="follower")
322
+
323
+ # 获取UP主信息
324
+ client.bilibili.get_account(mid="946974")
325
+
326
+ # 获取UP主视频列表(支持 mid 或 account_url)
327
+ client.bilibili.get_user_works(mid="946974", page=1, page_size=10, order="time")
328
+
329
+ # 获取视频详情(支持 bvid 或 work_url)
330
+ client.bilibili.get_work(bvid="BV1ghJg6hEWV")
331
+
332
+ # 获取视频音频地址
333
+ client.bilibili.get_audio(url="https://www.bilibili.com/video/BV1ghJg6hEWV")
334
+
335
+ # 视频提文案
336
+ task = client.bilibili.transcript_submit(url="https://www.bilibili.com/video/BV1ghJg6hEWV")
337
+ result = client.bilibili.transcript_result(task_id=task["taskId"])
338
+ ```
339
+
340
+ ### 今日头条
341
+
342
+ ```python
343
+ # 搜索内容
344
+ client.toutiao.search_works(keyword="AI", offset=0)
345
+
346
+ # 获取作品详情
347
+ client.toutiao.get_work(opus_id="7592180245936046626")
348
+
349
+ # 获取作品评论
350
+ client.toutiao.get_comments(opus_id="7592180245936046626")
351
+
352
+ # 搜索账号
353
+ client.toutiao.search_users(name="科技")
354
+
355
+ # 获取账号作品列表
356
+ client.toutiao.get_user_works(category="profile_all", token="MS4wLjABAAAA...")
357
+ ```
358
+
359
+ ### 快手
360
+
361
+ ```python
362
+ # 搜索作品
363
+ client.kuaishou.search_works(keyword="美食", page=1, size=20, sort="综合")
364
+
365
+ # 获取作品详情
366
+ client.kuaishou.get_work(photo_id="3x9sm2nqxmbfbuq")
367
+
368
+ # 获取账号作品列表(kwai_id / three_x_id 二选一)
369
+ client.kuaishou.get_user_works(three_x_id="3x4wxhrrzefrq4y", page=1)
370
+
371
+ # 搜索账号
372
+ client.kuaishou.search_users(account_name="美食作家王刚", page=1)
373
+
374
+ # 视频提文案
375
+ task = client.kuaishou.transcript_submit(url="https://www.kuaishou.com/short-video/xxx")
376
+ result = client.kuaishou.transcript_result(task_id=task["taskId"])
377
+ ```
378
+
379
+ ### TikTok
380
+
381
+ ```python
382
+ # 搜索用户
383
+ client.tiktok.search_users(keyword="tech", cursor=0)
384
+
385
+ # 搜索视频
386
+ client.tiktok.search_videos(keyword="AI", count="20", sort_type="0", region="US")
387
+
388
+ # 获取作品详情
389
+ client.tiktok.get_work(aweme_id="7532000000000000000")
390
+
391
+ # 获取用户主页作品
392
+ client.tiktok.get_user_works(sec_user_id="MS4wLjABAAAA...")
393
+ ```
394
+
395
+ ### YouTube
396
+
397
+ ```python
398
+ # 搜索视频
399
+ client.youtube.search_videos(search_query="AI tutorial")
400
+
401
+ # 获取视频详情
402
+ client.youtube.get_video(video_id="sa8AzBK4dao")
403
+
404
+ # 获取视频评论
405
+ client.youtube.get_comments(video_id="sa8AzBK4dao", sort_by="top")
406
+
407
+ # 视频提文案(提取字幕/口播文案)
408
+ client.youtube.get_transcript(video_url="https://www.youtube.com/watch?v=sa8AzBK4dao")
409
+ ```
410
+
411
+ ### X (Twitter)
412
+
413
+ ```python
414
+ # 搜索推文
415
+ client.twitter.search_tweets(keyword="AI", search_type="Top")
416
+
417
+ # 获取推文详情
418
+ client.twitter.get_tweet(tweet_id="1957000000000000000")
419
+
420
+ # 获取用户信息(screen_name / rest_id 至少传一个)
421
+ client.twitter.get_user(screen_name="elonmusk")
422
+
423
+ # 获取推文评论
424
+ client.twitter.get_comments(tweet_id="1957000000000000000")
425
+ ```
426
+
427
+ ### Instagram
428
+
429
+ ```python
430
+ # 综合搜索
431
+ client.instagram.search(keyword="travel")
432
+
433
+ # 获取帖子详情(Shortcode 或完整 URL)
434
+ client.instagram.get_post(code_or_url="DRhvwVLAHAG")
435
+
436
+ # 获取帖子评论
437
+ client.instagram.get_comments(code_or_url="DRhvwVLAHAG", sort_by="recent")
438
+
439
+ # 获取用户信息(username / user_id 至少传一个)
440
+ client.instagram.get_user(username="natgeo")
441
+ ```
442
+
443
+ ### 懂车帝
444
+
445
+ ```python
446
+ # 搜索作品
447
+ client.dongchedi.search_works(keyword="小米SU7", offset="0", source_type="1")
448
+
449
+ # 获取作品详情
450
+ client.dongchedi.get_work(work_id="7532000000000000000", work_type="video")
451
+
452
+ # 获取用户作品列表
453
+ client.dongchedi.get_user_works(user_id="60480000000000000", cursor=0)
454
+
455
+ # 搜索用户
456
+ client.dongchedi.search_users(keyword="陈震", offset=0)
457
+ ```
458
+
459
+ ### 易车
460
+
461
+ ```python
462
+ # 搜索作品(club=社区 / shipin=视频 / xinwen=文章)
463
+ client.yiche.search_works(keyword="小米SU7", page=1, source_type="xinwen")
464
+
465
+ # 获取文章详情
466
+ client.yiche.get_article(url="https://news.yiche.com/hao/wenzhang/xxx.html")
467
+
468
+ # 获取视频详情
469
+ client.yiche.get_video(work_id="50000000")
470
+
471
+ # 获取账号作品列表
472
+ client.yiche.get_user_works(user_id="600000000")
473
+
474
+ # 搜索账号
475
+ client.yiche.search_users(keyword="陈震", page=1)
476
+ ```
477
+
478
+ ### 汽车之家
479
+
480
+ ```python
481
+ # 搜索作品(club / article / video)
482
+ client.autohome.search_works(keyword="小米SU7", source_type="video")
483
+
484
+ # 获取文章详情(车家号)
485
+ client.autohome.get_article(work_id="3000000")
486
+
487
+ # 获取视频详情(0=原创账号,4=车家号)
488
+ client.autohome.get_video(video_id="5000000", video_type=4)
489
+
490
+ # 获取账号作品列表
491
+ client.autohome.get_user_works(author_id="7000000", page=0)
492
+ ```
493
+
494
+ ### 热点榜单
495
+
496
+ ```python
497
+ # 各平台热点榜:1=快手 2=抖音 5=微博 6=小红书 7=百度 8=B站 9=知乎 10=今日头条
498
+ client.hotspot.get_platform_rank(
499
+ platform=2,
500
+ start_date="2026-08-20",
501
+ end_date="2026-08-21",
502
+ )
503
+
504
+ # 全网热搜查询(关键词,时间范围不超过 30 天)
505
+ client.hotspot.search_by_keywords(
506
+ keywords=["三星"],
507
+ start_date="2026-08-01",
508
+ end_date="2026-08-21",
509
+ platforms=[2, 5, 10],
510
+ )
511
+
512
+ # 全网聚合热点 TOP10
513
+ client.hotspot.get_top10(
514
+ start_date="2026-08-20 00:00:00",
515
+ end_date="2026-08-21 00:00:00",
516
+ )
517
+ ```
518
+
519
+ ### 通用工具
520
+
521
+ ```python
522
+ # 短视频下载器(通用,自动识别平台)
523
+ client.tools.download(url="https://www.douyin.com/video/xxx")
524
+
525
+ # 各平台视频下载(去水印)
526
+ client.tools.download_douyin(url="https://www.douyin.com/video/xxx")
527
+ client.tools.download_kuaishou(url="https://www.kuaishou.com/short-video/xxx")
528
+ client.tools.download_xiaohongshu(url="https://www.xiaohongshu.com/explore/xxx")
529
+ client.tools.download_bilibili(url="https://www.bilibili.com/video/BV1xxx")
530
+ client.tools.download_wechat_channels(url="https://weixin.qq.com/sph/xxx")
531
+ client.tools.download_tiktok(url="https://www.tiktok.com/@user/video/xxx")
532
+ client.tools.download_youtube(url="https://www.youtube.com/watch?v=xxx")
533
+ client.tools.download_instagram(url="https://www.instagram.com/reel/xxx")
534
+ client.tools.download_twitter(url="https://x.com/user/status/xxx")
535
+
536
+ # 上传图片(png / jpeg / webp)
537
+ client.tools.upload_image(file="./cover.png", format="png")
538
+
539
+ # 上传视频/音频/图片素材
540
+ client.tools.upload_file(file="./clip.mp4", format="mp4")
541
+ ```
542
+
543
+ ### AI 搜索
544
+
545
+ ```python
546
+ # Kimi 搜索
547
+ task = client.ai_search.kimi_submit(inquiry_text="2026年AI发展趋势")
548
+ result = client.ai_search.kimi_result(task_id=task["taskId"])
549
+
550
+ # 豆包搜索
551
+ task = client.ai_search.doubao_submit(inquiry_text="夏日茶饮推荐")
552
+ result = client.ai_search.doubao_result(task_id=task["taskId"])
553
+
554
+ # Deepseek 搜索
555
+ task = client.ai_search.deepseek_submit(inquiry_text="Python性能优化")
556
+ result = client.ai_search.deepseek_result(task_id=task["taskId"])
557
+
558
+ # 元宝搜索
559
+ task = client.ai_search.yuanbao_submit(inquiry_text="新能源汽车推荐")
560
+ result = client.ai_search.yuanbao_result(task_id=task["taskId"])
561
+
562
+ # 千问搜索
563
+ task = client.ai_search.qianwen_submit(inquiry_text="杭州旅游攻略")
564
+ result = client.ai_search.qianwen_result(task_id=task["taskId"])
565
+
566
+ # 百度搜索
567
+ task = client.ai_search.baidu_submit(inquiry_text="今日财经要闻")
568
+ result = client.ai_search.baidu_result(task_id=task["taskId"])
569
+ ```
570
+
571
+ ### GPT 图片生成
572
+
573
+ ```python
574
+ # 文生图
575
+ task = client.gpt_image.submit(
576
+ prompt="一只坐在窗台上的橘猫,阳光洒在毛发上",
577
+ size="1024x1024",
578
+ quality="medium",
579
+ output_format="png",
580
+ model_name="gpt-image-2",
581
+ operation="generate",
582
+ )
583
+ result = client.gpt_image.result(task_id=task["taskId"])
584
+
585
+ # 图生图/编辑
586
+ task = client.gpt_image.submit(
587
+ prompt="将背景替换成海滩",
588
+ size="1024x1024",
589
+ model_name="gpt-image-2",
590
+ operation="edit",
591
+ input_fidelity=5,
592
+ images=[{"url": "https://example.com/your-image.jpg"}],
593
+ )
594
+ result = client.gpt_image.result(task_id=task["taskId"])
595
+ ```
596
+
597
+ ### 豆包图片生成
598
+
599
+ ```python
600
+ # Pro 模型
601
+ task = client.doubao_image.pro_submit(
602
+ prompt="一座漂浮在云端的未来城市",
603
+ size="2048x2048",
604
+ output_format="jpeg",
605
+ response_format="url",
606
+ watermark=False,
607
+ )
608
+ result = client.doubao_image.pro_result(task_id=task["taskId"])
609
+
610
+ # Lite 模型(支持组图)
611
+ task = client.doubao_image.lite_submit(
612
+ prompt="春夏秋冬四季风景画",
613
+ size="2048x2048",
614
+ output_format="jpeg",
615
+ response_format="url",
616
+ sequential="auto",
617
+ max_images=4,
618
+ )
619
+ result = client.doubao_image.lite_result(task_id=task["taskId"])
620
+ ```
621
+
622
+ ### 豆包视频生成
623
+
624
+ ```python
625
+ # 文生视频
626
+ task = client.doubao_video.submit(
627
+ content=[{"type": "text", "text": "一只猫在阳光下打哈欠,毛发随着微风轻轻飘动"}],
628
+ resolution="720p",
629
+ ratio="16:9",
630
+ duration=5,
631
+ watermark=False,
632
+ generate_audio=True,
633
+ )
634
+ result = client.doubao_video.result(task_id=task["taskId"])
635
+
636
+ # 图生视频
637
+ task = client.doubao_video.submit(
638
+ content=[
639
+ {"type": "text", "text": "让图中的人物微笑并挥手"},
640
+ {"type": "image_url", "image_url": "https://example.com/photo.jpg"},
641
+ ],
642
+ resolution="720p",
643
+ duration=5,
644
+ )
645
+ result = client.doubao_video.result(task_id=task["taskId"])
646
+ ```
647
+
648
+ ## 错误处理
649
+
650
+ SDK 提供三种异常类型:
651
+
652
+ ```python
653
+ from redfox import RedFoxAPIError, RedFoxAuthError, RedFoxRateLimitError
654
+
655
+ try:
656
+ result = client.douyin.search_articles(keyword="AI")
657
+ except RedFoxAuthError as e:
658
+ print(f"认证失败: {e}")
659
+ except RedFoxRateLimitError as e:
660
+ print(f"频率超限: {e}")
661
+ except RedFoxAPIError as e:
662
+ print(f"API错误: code={e.code}, msg={e}")
663
+ ```
664
+
665
+ ## 依赖
666
+
667
+ - Python >= 3.8
668
+ - httpx >= 0.25.0
669
+
670
+ ## 许可证
671
+
672
+ MIT License