redfox-python-sdk 0.5.1__tar.gz → 0.5.2__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.
- {redfox_python_sdk-0.5.1 → redfox_python_sdk-0.5.2}/PKG-INFO +1 -1
- {redfox_python_sdk-0.5.1 → redfox_python_sdk-0.5.2}/redfox/__init__.py +1 -1
- {redfox_python_sdk-0.5.1 → redfox_python_sdk-0.5.2}/redfox/client.py +32 -11
- {redfox_python_sdk-0.5.1 → redfox_python_sdk-0.5.2}/redfox/endpoints/ai_search.py +24 -24
- {redfox_python_sdk-0.5.1 → redfox_python_sdk-0.5.2}/redfox/endpoints/autohome.py +8 -4
- {redfox_python_sdk-0.5.1 → redfox_python_sdk-0.5.2}/redfox/endpoints/bilibili.py +16 -12
- {redfox_python_sdk-0.5.1 → redfox_python_sdk-0.5.2}/redfox/endpoints/dongchedi.py +8 -4
- {redfox_python_sdk-0.5.1 → redfox_python_sdk-0.5.2}/redfox/endpoints/doubao_image.py +8 -6
- {redfox_python_sdk-0.5.1 → redfox_python_sdk-0.5.2}/redfox/endpoints/doubao_video.py +4 -2
- {redfox_python_sdk-0.5.1 → redfox_python_sdk-0.5.2}/redfox/endpoints/douyin.py +32 -15
- {redfox_python_sdk-0.5.1 → redfox_python_sdk-0.5.2}/redfox/endpoints/gpt_image.py +4 -3
- {redfox_python_sdk-0.5.1 → redfox_python_sdk-0.5.2}/redfox/endpoints/hotspot.py +6 -2
- {redfox_python_sdk-0.5.1 → redfox_python_sdk-0.5.2}/redfox/endpoints/instagram.py +8 -5
- {redfox_python_sdk-0.5.1 → redfox_python_sdk-0.5.2}/redfox/endpoints/kuaishou.py +12 -7
- {redfox_python_sdk-0.5.1 → redfox_python_sdk-0.5.2}/redfox/endpoints/tiktok.py +8 -4
- {redfox_python_sdk-0.5.1 → redfox_python_sdk-0.5.2}/redfox/endpoints/tools.py +24 -22
- {redfox_python_sdk-0.5.1 → redfox_python_sdk-0.5.2}/redfox/endpoints/toutiao.py +10 -7
- {redfox_python_sdk-0.5.1 → redfox_python_sdk-0.5.2}/redfox/endpoints/twitter.py +8 -5
- {redfox_python_sdk-0.5.1 → redfox_python_sdk-0.5.2}/redfox/endpoints/wechat.py +32 -17
- {redfox_python_sdk-0.5.1 → redfox_python_sdk-0.5.2}/redfox/endpoints/wechat_channels.py +14 -11
- {redfox_python_sdk-0.5.1 → redfox_python_sdk-0.5.2}/redfox/endpoints/xiaohongshu.py +31 -20
- {redfox_python_sdk-0.5.1 → redfox_python_sdk-0.5.2}/redfox/endpoints/yiche.py +10 -8
- {redfox_python_sdk-0.5.1 → redfox_python_sdk-0.5.2}/redfox/endpoints/youtube.py +8 -5
- {redfox_python_sdk-0.5.1 → redfox_python_sdk-0.5.2}/redfox_python_sdk.egg-info/PKG-INFO +1 -1
- {redfox_python_sdk-0.5.1 → redfox_python_sdk-0.5.2}/setup.py +1 -1
- {redfox_python_sdk-0.5.1 → redfox_python_sdk-0.5.2}/README.md +0 -0
- {redfox_python_sdk-0.5.1 → redfox_python_sdk-0.5.2}/redfox/endpoints/__init__.py +0 -0
- {redfox_python_sdk-0.5.1 → redfox_python_sdk-0.5.2}/redfox/exceptions.py +0 -0
- {redfox_python_sdk-0.5.1 → redfox_python_sdk-0.5.2}/redfox_python_sdk.egg-info/SOURCES.txt +0 -0
- {redfox_python_sdk-0.5.1 → redfox_python_sdk-0.5.2}/redfox_python_sdk.egg-info/dependency_links.txt +0 -0
- {redfox_python_sdk-0.5.1 → redfox_python_sdk-0.5.2}/redfox_python_sdk.egg-info/requires.txt +0 -0
- {redfox_python_sdk-0.5.1 → redfox_python_sdk-0.5.2}/redfox_python_sdk.egg-info/top_level.txt +0 -0
- {redfox_python_sdk-0.5.1 → redfox_python_sdk-0.5.2}/setup.cfg +0 -0
|
@@ -67,13 +67,22 @@ class _RequestMixin:
|
|
|
67
67
|
self, method: str, path: str,
|
|
68
68
|
params: Optional[Dict[str, Any]] = None,
|
|
69
69
|
data: Optional[Dict[str, Any]] = None,
|
|
70
|
+
source: Optional[str] = None,
|
|
70
71
|
) -> tuple:
|
|
71
|
-
"""准备请求 URL 和清洗后的参数
|
|
72
|
+
"""准备请求 URL 和清洗后的参数
|
|
73
|
+
|
|
74
|
+
source 为调用来源标识:GET 请求放入 query,其余放入请求体 body。
|
|
75
|
+
"""
|
|
72
76
|
url = f"{self.base_url}{path}"
|
|
73
77
|
if data:
|
|
74
78
|
data = {k: v for k, v in data.items() if v is not None}
|
|
75
79
|
if params:
|
|
76
80
|
params = {k: v for k, v in params.items() if v is not None}
|
|
81
|
+
if source is not None:
|
|
82
|
+
if method.upper() == "GET":
|
|
83
|
+
params = {**(params or {}), "source": source}
|
|
84
|
+
else:
|
|
85
|
+
data = {**(data or {}), "source": source}
|
|
77
86
|
return url, params, data
|
|
78
87
|
|
|
79
88
|
def _handle_response(self, response) -> dict:
|
|
@@ -231,6 +240,7 @@ class RedFoxClient(_RequestMixin):
|
|
|
231
240
|
path: str,
|
|
232
241
|
params: Optional[Dict[str, Any]] = None,
|
|
233
242
|
data: Optional[Dict[str, Any]] = None,
|
|
243
|
+
source: Optional[str] = None,
|
|
234
244
|
) -> dict:
|
|
235
245
|
"""
|
|
236
246
|
发送 API 请求(含自动重试 + 指数退避)
|
|
@@ -242,7 +252,7 @@ class RedFoxClient(_RequestMixin):
|
|
|
242
252
|
:return: API 响应 data 字段内容
|
|
243
253
|
:raises RedFoxAPIError: 重试耗尽后仍失败时抛出
|
|
244
254
|
"""
|
|
245
|
-
url, params, data = self._prepare_request(method, path, params, data)
|
|
255
|
+
url, params, data = self._prepare_request(method, path, params, data, source)
|
|
246
256
|
last_exception = None
|
|
247
257
|
|
|
248
258
|
for attempt in range(self.max_retries + 1):
|
|
@@ -285,13 +295,15 @@ class RedFoxClient(_RequestMixin):
|
|
|
285
295
|
# 重试耗尽
|
|
286
296
|
raise self._map_exception(last_exception) if last_exception else RedFoxAPIError("请求失败")
|
|
287
297
|
|
|
288
|
-
def post(self, path: str, data: Optional[Dict[str, Any]] = None
|
|
298
|
+
def post(self, path: str, data: Optional[Dict[str, Any]] = None,
|
|
299
|
+
source: Optional[str] = None) -> dict:
|
|
289
300
|
"""发送 POST 请求"""
|
|
290
|
-
return self.request("POST", path, data=data)
|
|
301
|
+
return self.request("POST", path, data=data, source=source)
|
|
291
302
|
|
|
292
|
-
def get(self, path: str, params: Optional[Dict[str, Any]] = None
|
|
303
|
+
def get(self, path: str, params: Optional[Dict[str, Any]] = None,
|
|
304
|
+
source: Optional[str] = None) -> dict:
|
|
293
305
|
"""发送 GET 请求"""
|
|
294
|
-
return self.request("GET", path, params=params)
|
|
306
|
+
return self.request("GET", path, params=params, source=source)
|
|
295
307
|
|
|
296
308
|
def upload(
|
|
297
309
|
self,
|
|
@@ -299,6 +311,7 @@ class RedFoxClient(_RequestMixin):
|
|
|
299
311
|
file,
|
|
300
312
|
data: Optional[Dict[str, Any]] = None,
|
|
301
313
|
field_name: str = "file",
|
|
314
|
+
source: Optional[str] = None,
|
|
302
315
|
) -> dict:
|
|
303
316
|
"""
|
|
304
317
|
上传文件(multipart/form-data,含自动重试)
|
|
@@ -313,6 +326,8 @@ class RedFoxClient(_RequestMixin):
|
|
|
313
326
|
filename, content = self._read_file(file, field_name)
|
|
314
327
|
if data:
|
|
315
328
|
data = {k: v for k, v in data.items() if v is not None}
|
|
329
|
+
if source is not None:
|
|
330
|
+
data = {**(data or {}), "source": source}
|
|
316
331
|
last_exception = None
|
|
317
332
|
|
|
318
333
|
for attempt in range(self.max_retries + 1):
|
|
@@ -445,6 +460,7 @@ class AsyncRedFoxClient(_RequestMixin):
|
|
|
445
460
|
path: str,
|
|
446
461
|
params: Optional[Dict[str, Any]] = None,
|
|
447
462
|
data: Optional[Dict[str, Any]] = None,
|
|
463
|
+
source: Optional[str] = None,
|
|
448
464
|
) -> dict:
|
|
449
465
|
"""
|
|
450
466
|
异步发送 API 请求(含自动重试 + 指数退避)
|
|
@@ -455,7 +471,7 @@ class AsyncRedFoxClient(_RequestMixin):
|
|
|
455
471
|
:param data: 请求体 JSON 数据
|
|
456
472
|
:return: API 响应 data 字段内容
|
|
457
473
|
"""
|
|
458
|
-
url, params, data = self._prepare_request(method, path, params, data)
|
|
474
|
+
url, params, data = self._prepare_request(method, path, params, data, source)
|
|
459
475
|
last_exception = None
|
|
460
476
|
|
|
461
477
|
for attempt in range(self.max_retries + 1):
|
|
@@ -495,13 +511,15 @@ class AsyncRedFoxClient(_RequestMixin):
|
|
|
495
511
|
|
|
496
512
|
raise self._map_exception(last_exception) if last_exception else RedFoxAPIError("请求失败")
|
|
497
513
|
|
|
498
|
-
async def post(self, path: str, data: Optional[Dict[str, Any]] = None
|
|
514
|
+
async def post(self, path: str, data: Optional[Dict[str, Any]] = None,
|
|
515
|
+
source: Optional[str] = None) -> dict:
|
|
499
516
|
"""异步发送 POST 请求"""
|
|
500
|
-
return await self.request("POST", path, data=data)
|
|
517
|
+
return await self.request("POST", path, data=data, source=source)
|
|
501
518
|
|
|
502
|
-
async def get(self, path: str, params: Optional[Dict[str, Any]] = None
|
|
519
|
+
async def get(self, path: str, params: Optional[Dict[str, Any]] = None,
|
|
520
|
+
source: Optional[str] = None) -> dict:
|
|
503
521
|
"""异步发送 GET 请求"""
|
|
504
|
-
return await self.request("GET", path, params=params)
|
|
522
|
+
return await self.request("GET", path, params=params, source=source)
|
|
505
523
|
|
|
506
524
|
async def upload(
|
|
507
525
|
self,
|
|
@@ -509,6 +527,7 @@ class AsyncRedFoxClient(_RequestMixin):
|
|
|
509
527
|
file,
|
|
510
528
|
data: Optional[Dict[str, Any]] = None,
|
|
511
529
|
field_name: str = "file",
|
|
530
|
+
source: Optional[str] = None,
|
|
512
531
|
) -> dict:
|
|
513
532
|
"""
|
|
514
533
|
异步上传文件(multipart/form-data,含自动重试)
|
|
@@ -523,6 +542,8 @@ class AsyncRedFoxClient(_RequestMixin):
|
|
|
523
542
|
filename, content = self._read_file(file, field_name)
|
|
524
543
|
if data:
|
|
525
544
|
data = {k: v for k, v in data.items() if v is not None}
|
|
545
|
+
if source is not None:
|
|
546
|
+
data = {**(data or {}), "source": source}
|
|
526
547
|
last_exception = None
|
|
527
548
|
|
|
528
549
|
for attempt in range(self.max_retries + 1):
|
|
@@ -16,7 +16,7 @@ class AISearchAPI:
|
|
|
16
16
|
|
|
17
17
|
# ─── Kimi ───────────────────────────────────────────────
|
|
18
18
|
|
|
19
|
-
def kimi_submit(self, inquiry_text: str) -> dict:
|
|
19
|
+
def kimi_submit(self, inquiry_text: str, source: str = "Kimi 联网 AI 搜索-SDK") -> dict:
|
|
20
20
|
"""
|
|
21
21
|
Kimi 纯文字搜索 - 提交任务
|
|
22
22
|
|
|
@@ -24,10 +24,10 @@ class AISearchAPI:
|
|
|
24
24
|
:return: 包含 taskId 的字典
|
|
25
25
|
"""
|
|
26
26
|
return self._client.post(
|
|
27
|
-
"/story/api/kimi/submit", data={"inquiryText": inquiry_text}
|
|
27
|
+
"/story/api/kimi/submit", data={"inquiryText": inquiry_text}, source=source
|
|
28
28
|
)
|
|
29
29
|
|
|
30
|
-
def kimi_result(self, task_id: str) -> dict:
|
|
30
|
+
def kimi_result(self, task_id: str, source: str = "查询 Kimi 搜索任务结果-SDK") -> dict:
|
|
31
31
|
"""
|
|
32
32
|
Kimi 纯文字搜索 - 查询任务结果
|
|
33
33
|
|
|
@@ -35,12 +35,12 @@ class AISearchAPI:
|
|
|
35
35
|
:return: 任务结果字典,包含 completed/content/webPages
|
|
36
36
|
"""
|
|
37
37
|
return self._client.post(
|
|
38
|
-
"/story/api/kimi/result", data={"taskId": task_id}
|
|
38
|
+
"/story/api/kimi/result", data={"taskId": task_id}, source=source
|
|
39
39
|
)
|
|
40
40
|
|
|
41
41
|
# ─── 豆包 ───────────────────────────────────────────────
|
|
42
42
|
|
|
43
|
-
def doubao_submit(self, inquiry_text: str) -> dict:
|
|
43
|
+
def doubao_submit(self, inquiry_text: str, source: str = "豆包联网 AI 搜索-SDK") -> dict:
|
|
44
44
|
"""
|
|
45
45
|
豆包纯文字搜索 - 提交任务
|
|
46
46
|
|
|
@@ -48,10 +48,10 @@ class AISearchAPI:
|
|
|
48
48
|
:return: 包含 taskId 的字典
|
|
49
49
|
"""
|
|
50
50
|
return self._client.post(
|
|
51
|
-
"/story/api/deepSearch/dbSubmit", data={"inquiryText": inquiry_text}
|
|
51
|
+
"/story/api/deepSearch/dbSubmit", data={"inquiryText": inquiry_text}, source=source
|
|
52
52
|
)
|
|
53
53
|
|
|
54
|
-
def doubao_result(self, task_id: str) -> dict:
|
|
54
|
+
def doubao_result(self, task_id: str, source: str = "查询豆包搜索任务结果-SDK") -> dict:
|
|
55
55
|
"""
|
|
56
56
|
豆包纯文字搜索 - 查询任务结果
|
|
57
57
|
|
|
@@ -59,12 +59,12 @@ class AISearchAPI:
|
|
|
59
59
|
:return: 任务结果字典
|
|
60
60
|
"""
|
|
61
61
|
return self._client.post(
|
|
62
|
-
"/story/api/deepSearch/dbResult", data={"taskId": task_id}
|
|
62
|
+
"/story/api/deepSearch/dbResult", data={"taskId": task_id}, source=source
|
|
63
63
|
)
|
|
64
64
|
|
|
65
65
|
# ─── Deepseek ───────────────────────────────────────────
|
|
66
66
|
|
|
67
|
-
def deepseek_submit(self, inquiry_text: str) -> dict:
|
|
67
|
+
def deepseek_submit(self, inquiry_text: str, source: str = "Deepseek 联网 AI 搜索-SDK") -> dict:
|
|
68
68
|
"""
|
|
69
69
|
Deepseek 纯文字搜索 - 提交任务
|
|
70
70
|
|
|
@@ -72,10 +72,10 @@ class AISearchAPI:
|
|
|
72
72
|
:return: 包含 taskId 的字典
|
|
73
73
|
"""
|
|
74
74
|
return self._client.post(
|
|
75
|
-
"/story/api/deepSearch/dsSubmit", data={"inquiryText": inquiry_text}
|
|
75
|
+
"/story/api/deepSearch/dsSubmit", data={"inquiryText": inquiry_text}, source=source
|
|
76
76
|
)
|
|
77
77
|
|
|
78
|
-
def deepseek_result(self, task_id: str) -> dict:
|
|
78
|
+
def deepseek_result(self, task_id: str, source: str = "查询 Deepseek 搜索任务结果-SDK") -> dict:
|
|
79
79
|
"""
|
|
80
80
|
Deepseek 纯文字搜索 - 查询任务结果
|
|
81
81
|
|
|
@@ -83,12 +83,12 @@ class AISearchAPI:
|
|
|
83
83
|
:return: 任务结果字典
|
|
84
84
|
"""
|
|
85
85
|
return self._client.post(
|
|
86
|
-
"/story/api/deepSearch/dsResult", data={"taskId": task_id}
|
|
86
|
+
"/story/api/deepSearch/dsResult", data={"taskId": task_id}, source=source
|
|
87
87
|
)
|
|
88
88
|
|
|
89
89
|
# ─── 元宝 ───────────────────────────────────────────────
|
|
90
90
|
|
|
91
|
-
def yuanbao_submit(self, inquiry_text: str) -> dict:
|
|
91
|
+
def yuanbao_submit(self, inquiry_text: str, source: str = "元宝联网 AI 搜索-SDK") -> dict:
|
|
92
92
|
"""
|
|
93
93
|
元宝纯文字搜索 - 提交任务
|
|
94
94
|
|
|
@@ -96,10 +96,10 @@ class AISearchAPI:
|
|
|
96
96
|
:return: 包含 taskId 的字典
|
|
97
97
|
"""
|
|
98
98
|
return self._client.post(
|
|
99
|
-
"/story/api/deepSearch/ybSubmit", data={"inquiryText": inquiry_text}
|
|
99
|
+
"/story/api/deepSearch/ybSubmit", data={"inquiryText": inquiry_text}, source=source
|
|
100
100
|
)
|
|
101
101
|
|
|
102
|
-
def yuanbao_result(self, task_id: str) -> dict:
|
|
102
|
+
def yuanbao_result(self, task_id: str, source: str = "查询元宝搜索任务结果-SDK") -> dict:
|
|
103
103
|
"""
|
|
104
104
|
元宝纯文字搜索 - 查询任务结果
|
|
105
105
|
|
|
@@ -107,12 +107,12 @@ class AISearchAPI:
|
|
|
107
107
|
:return: 任务结果字典
|
|
108
108
|
"""
|
|
109
109
|
return self._client.post(
|
|
110
|
-
"/story/api/deepSearch/ybResult", data={"taskId": task_id}
|
|
110
|
+
"/story/api/deepSearch/ybResult", data={"taskId": task_id}, source=source
|
|
111
111
|
)
|
|
112
112
|
|
|
113
113
|
# ─── 千问 ───────────────────────────────────────────────
|
|
114
114
|
|
|
115
|
-
def qianwen_submit(self, inquiry_text: str) -> dict:
|
|
115
|
+
def qianwen_submit(self, inquiry_text: str, source: str = "千问联网 AI 搜索-SDK") -> dict:
|
|
116
116
|
"""
|
|
117
117
|
千问纯文字搜索 - 提交任务
|
|
118
118
|
|
|
@@ -120,10 +120,10 @@ class AISearchAPI:
|
|
|
120
120
|
:return: 包含 taskId 的字典
|
|
121
121
|
"""
|
|
122
122
|
return self._client.post(
|
|
123
|
-
"/story/api/deepSearch/qwSubmit", data={"inquiryText": inquiry_text}
|
|
123
|
+
"/story/api/deepSearch/qwSubmit", data={"inquiryText": inquiry_text}, source=source
|
|
124
124
|
)
|
|
125
125
|
|
|
126
|
-
def qianwen_result(self, task_id: str) -> dict:
|
|
126
|
+
def qianwen_result(self, task_id: str, source: str = "查询千问搜索任务结果-SDK") -> dict:
|
|
127
127
|
"""
|
|
128
128
|
千问纯文字搜索 - 查询任务结果
|
|
129
129
|
|
|
@@ -131,12 +131,12 @@ class AISearchAPI:
|
|
|
131
131
|
:return: 任务结果字典
|
|
132
132
|
"""
|
|
133
133
|
return self._client.post(
|
|
134
|
-
"/story/api/deepSearch/qwResult", data={"taskId": task_id}
|
|
134
|
+
"/story/api/deepSearch/qwResult", data={"taskId": task_id}, source=source
|
|
135
135
|
)
|
|
136
136
|
|
|
137
137
|
# ─── 百度 ───────────────────────────────────────────────
|
|
138
138
|
|
|
139
|
-
def baidu_submit(self, inquiry_text: str) -> dict:
|
|
139
|
+
def baidu_submit(self, inquiry_text: str, source: str = "百度联网 AI 搜索-SDK") -> dict:
|
|
140
140
|
"""
|
|
141
141
|
百度纯文字搜索 - 提交任务
|
|
142
142
|
|
|
@@ -144,10 +144,10 @@ class AISearchAPI:
|
|
|
144
144
|
:return: 包含 taskId 的字典
|
|
145
145
|
"""
|
|
146
146
|
return self._client.post(
|
|
147
|
-
"/story/api/deepSearch/bdSubmit", data={"inquiryText": inquiry_text}
|
|
147
|
+
"/story/api/deepSearch/bdSubmit", data={"inquiryText": inquiry_text}, source=source
|
|
148
148
|
)
|
|
149
149
|
|
|
150
|
-
def baidu_result(self, task_id: str) -> dict:
|
|
150
|
+
def baidu_result(self, task_id: str, source: str = "查询百度搜索任务结果-SDK") -> dict:
|
|
151
151
|
"""
|
|
152
152
|
百度纯文字搜索 - 查询任务结果
|
|
153
153
|
|
|
@@ -155,5 +155,5 @@ class AISearchAPI:
|
|
|
155
155
|
:return: 任务结果字典
|
|
156
156
|
"""
|
|
157
157
|
return self._client.post(
|
|
158
|
-
"/story/api/deepSearch/bdResult", data={"taskId": task_id}
|
|
158
|
+
"/story/api/deepSearch/bdResult", data={"taskId": task_id}, source=source
|
|
159
159
|
)
|
|
@@ -19,6 +19,7 @@ class AutohomeAPI:
|
|
|
19
19
|
offset: str = "0",
|
|
20
20
|
page: str = "1",
|
|
21
21
|
source_type: str = "video",
|
|
22
|
+
source: str = "汽车之家关键词搜索作品-SDK",
|
|
22
23
|
) -> dict:
|
|
23
24
|
"""
|
|
24
25
|
汽车之家关键词搜索作品
|
|
@@ -35,9 +36,9 @@ class AutohomeAPI:
|
|
|
35
36
|
"page": str(page),
|
|
36
37
|
"sourceType": source_type,
|
|
37
38
|
}
|
|
38
|
-
return self._client.post("/story/api/autohome/searchWork", data=data)
|
|
39
|
+
return self._client.post("/story/api/autohome/searchWork", data=data, source=source)
|
|
39
40
|
|
|
40
|
-
def get_article(self, work_id: str, page: int = 0) -> dict:
|
|
41
|
+
def get_article(self, work_id: str, page: int = 0, source: str = "获取汽车之家文章详情-SDK") -> dict:
|
|
41
42
|
"""
|
|
42
43
|
汽车之家文章详情(车家号)
|
|
43
44
|
|
|
@@ -48,9 +49,10 @@ class AutohomeAPI:
|
|
|
48
49
|
return self._client.post(
|
|
49
50
|
"/story/api/autohome/articleDetail",
|
|
50
51
|
data={"workId": work_id, "page": page},
|
|
52
|
+
source=source,
|
|
51
53
|
)
|
|
52
54
|
|
|
53
|
-
def get_video(self, video_id: str, video_type: int) -> dict:
|
|
55
|
+
def get_video(self, video_id: str, video_type: int, source: str = "获取汽车之家视频详情-SDK") -> dict:
|
|
54
56
|
"""
|
|
55
57
|
汽车之家视频详情(原创账号+车家号)
|
|
56
58
|
|
|
@@ -61,9 +63,10 @@ class AutohomeAPI:
|
|
|
61
63
|
return self._client.post(
|
|
62
64
|
"/story/api/autohome/videoDetail",
|
|
63
65
|
data={"videoId": video_id, "videoType": video_type},
|
|
66
|
+
source=source,
|
|
64
67
|
)
|
|
65
68
|
|
|
66
|
-
def get_user_works(self, author_id: str, page: int = 0) -> dict:
|
|
69
|
+
def get_user_works(self, author_id: str, page: int = 0, source: str = "获取汽车之家作者作品列表-SDK") -> dict:
|
|
67
70
|
"""
|
|
68
71
|
汽车之家作品列表(原创账号)
|
|
69
72
|
|
|
@@ -74,4 +77,5 @@ class AutohomeAPI:
|
|
|
74
77
|
return self._client.post(
|
|
75
78
|
"/story/api/autohome/workList",
|
|
76
79
|
data={"authorId": author_id, "page": page},
|
|
80
|
+
source=source,
|
|
77
81
|
)
|
|
@@ -13,7 +13,7 @@ class BilibiliAPI:
|
|
|
13
13
|
def __init__(self, client):
|
|
14
14
|
self._client = client
|
|
15
15
|
|
|
16
|
-
def get_account(self, mid: str) -> dict:
|
|
16
|
+
def get_account(self, mid: str, source: str = "获取 B 站 UP 主信息-SDK") -> dict:
|
|
17
17
|
"""
|
|
18
18
|
获取哔哩哔哩账号信息(优质库)
|
|
19
19
|
|
|
@@ -21,13 +21,14 @@ class BilibiliAPI:
|
|
|
21
21
|
:return: 账号信息字典
|
|
22
22
|
"""
|
|
23
23
|
return self._client.post(
|
|
24
|
-
"/story/api/bili/data/accountDetail", data={"mid": mid}
|
|
24
|
+
"/story/api/bili/data/accountDetail", data={"mid": mid}, source=source
|
|
25
25
|
)
|
|
26
26
|
|
|
27
27
|
def get_work(
|
|
28
28
|
self,
|
|
29
29
|
bvid: str = None,
|
|
30
30
|
work_url: str = None,
|
|
31
|
+
source: str = "获取 B 站视频详情-SDK",
|
|
31
32
|
) -> dict:
|
|
32
33
|
"""
|
|
33
34
|
获取哔哩哔哩作品内容详情(优质库)
|
|
@@ -43,7 +44,7 @@ class BilibiliAPI:
|
|
|
43
44
|
data["bvId"] = bvid
|
|
44
45
|
if work_url:
|
|
45
46
|
data["workUrl"] = work_url
|
|
46
|
-
return self._client.post("/story/api/bili/data/workDetail", data=data)
|
|
47
|
+
return self._client.post("/story/api/bili/data/workDetail", data=data, source=source)
|
|
47
48
|
|
|
48
49
|
def search_users(
|
|
49
50
|
self,
|
|
@@ -51,6 +52,7 @@ class BilibiliAPI:
|
|
|
51
52
|
page: int = 1,
|
|
52
53
|
page_size: int = None,
|
|
53
54
|
order: str = None,
|
|
55
|
+
source: str = "搜索 B 站 UP 主-SDK",
|
|
54
56
|
) -> dict:
|
|
55
57
|
"""
|
|
56
58
|
搜索关键词获取哔哩哔哩账号(优质库)
|
|
@@ -66,7 +68,7 @@ class BilibiliAPI:
|
|
|
66
68
|
data["pageSize"] = page_size
|
|
67
69
|
if order is not None:
|
|
68
70
|
data["order"] = order
|
|
69
|
-
return self._client.post("/story/api/bili/data/accountSearch", data=data)
|
|
71
|
+
return self._client.post("/story/api/bili/data/accountSearch", data=data, source=source)
|
|
70
72
|
|
|
71
73
|
def search_articles(
|
|
72
74
|
self,
|
|
@@ -74,6 +76,7 @@ class BilibiliAPI:
|
|
|
74
76
|
page: int = 1,
|
|
75
77
|
page_size: int = None,
|
|
76
78
|
order: str = None,
|
|
79
|
+
source: str = "搜索 B 站视频-SDK",
|
|
77
80
|
) -> dict:
|
|
78
81
|
"""
|
|
79
82
|
搜索关键词获取哔哩哔哩作品(优质库)
|
|
@@ -89,7 +92,7 @@ class BilibiliAPI:
|
|
|
89
92
|
data["pageSize"] = page_size
|
|
90
93
|
if order is not None:
|
|
91
94
|
data["order"] = order
|
|
92
|
-
return self._client.post("/story/api/bili/data/workSearch", data=data)
|
|
95
|
+
return self._client.post("/story/api/bili/data/workSearch", data=data, source=source)
|
|
93
96
|
|
|
94
97
|
def get_user_works(
|
|
95
98
|
self,
|
|
@@ -98,6 +101,7 @@ class BilibiliAPI:
|
|
|
98
101
|
page: int = 1,
|
|
99
102
|
page_size: int = None,
|
|
100
103
|
order: str = None,
|
|
104
|
+
source: str = "获取 B 站 UP 主视频列表-SDK",
|
|
101
105
|
) -> dict:
|
|
102
106
|
"""
|
|
103
107
|
获取哔哩哔哩账号作品列表(优质库)
|
|
@@ -120,11 +124,11 @@ class BilibiliAPI:
|
|
|
120
124
|
data["pageSize"] = page_size
|
|
121
125
|
if order is not None:
|
|
122
126
|
data["order"] = order
|
|
123
|
-
return self._client.post("/story/api/bili/data/accountWorkList", data=data)
|
|
127
|
+
return self._client.post("/story/api/bili/data/accountWorkList", data=data, source=source)
|
|
124
128
|
|
|
125
129
|
# ─── 音频 / 提文案 ─────────────────────────────────────
|
|
126
130
|
|
|
127
|
-
def get_audio(self, url: str) -> dict:
|
|
131
|
+
def get_audio(self, url: str, source: str = "获取 B 站视频音频地址-SDK") -> dict:
|
|
128
132
|
"""
|
|
129
133
|
获取哔哩哔哩音频地址
|
|
130
134
|
|
|
@@ -132,10 +136,10 @@ class BilibiliAPI:
|
|
|
132
136
|
:return: 音频地址字典
|
|
133
137
|
"""
|
|
134
138
|
return self._client.post(
|
|
135
|
-
"/story/api/parseWork/audioExtract/bilibili", data={"url": url}
|
|
139
|
+
"/story/api/parseWork/audioExtract/bilibili", data={"url": url}, source=source
|
|
136
140
|
)
|
|
137
141
|
|
|
138
|
-
def transcript_submit(self, url: str) -> dict:
|
|
142
|
+
def transcript_submit(self, url: str, source: str = "B 站视频字幕/文案提取-SDK") -> dict:
|
|
139
143
|
"""
|
|
140
144
|
哔哩哔哩链接提文案 - 提交任务
|
|
141
145
|
|
|
@@ -143,10 +147,10 @@ class BilibiliAPI:
|
|
|
143
147
|
:return: 包含 taskId 的字典
|
|
144
148
|
"""
|
|
145
149
|
return self._client.post(
|
|
146
|
-
"/story/api/parseWork/bilibiliSubtitle/submit", data={"url": url}
|
|
150
|
+
"/story/api/parseWork/bilibiliSubtitle/submit", data={"url": url}, source=source
|
|
147
151
|
)
|
|
148
152
|
|
|
149
|
-
def transcript_result(self, task_id: str) -> dict:
|
|
153
|
+
def transcript_result(self, task_id: str, source: str = "查询 B 站字幕提取任务结果-SDK") -> dict:
|
|
150
154
|
"""
|
|
151
155
|
哔哩哔哩链接提文案 - 查询结果
|
|
152
156
|
|
|
@@ -154,5 +158,5 @@ class BilibiliAPI:
|
|
|
154
158
|
:return: 文案提取结果字典
|
|
155
159
|
"""
|
|
156
160
|
return self._client.post(
|
|
157
|
-
"/story/api/parseWork/bilibiliSubtitle/result", data={"taskId": task_id}
|
|
161
|
+
"/story/api/parseWork/bilibiliSubtitle/result", data={"taskId": task_id}, source=source
|
|
158
162
|
)
|
|
@@ -18,6 +18,7 @@ class DongchediAPI:
|
|
|
18
18
|
keyword: str,
|
|
19
19
|
offset: str = "0",
|
|
20
20
|
source_type: str = "1",
|
|
21
|
+
source: str = "懂车帝关键词搜索作品-SDK",
|
|
21
22
|
) -> dict:
|
|
22
23
|
"""
|
|
23
24
|
懂车帝关键词搜索作品
|
|
@@ -32,9 +33,9 @@ class DongchediAPI:
|
|
|
32
33
|
"offset": str(offset),
|
|
33
34
|
"sourceType": str(source_type),
|
|
34
35
|
}
|
|
35
|
-
return self._client.post("/story/api/dongchedi/searchWork", data=data)
|
|
36
|
+
return self._client.post("/story/api/dongchedi/searchWork", data=data, source=source)
|
|
36
37
|
|
|
37
|
-
def get_work(self, work_id: str, work_type: str) -> dict:
|
|
38
|
+
def get_work(self, work_id: str, work_type: str, source: str = "获取懂车帝作品详情-SDK") -> dict:
|
|
38
39
|
"""
|
|
39
40
|
懂车帝作品详情
|
|
40
41
|
|
|
@@ -45,9 +46,10 @@ class DongchediAPI:
|
|
|
45
46
|
return self._client.post(
|
|
46
47
|
"/story/api/dongchedi/workDetail",
|
|
47
48
|
data={"workId": work_id, "workType": work_type},
|
|
49
|
+
source=source,
|
|
48
50
|
)
|
|
49
51
|
|
|
50
|
-
def get_user_works(self, user_id: str, cursor: int = 0) -> dict:
|
|
52
|
+
def get_user_works(self, user_id: str, cursor: int = 0, source: str = "获取懂车帝用户作品列表-SDK") -> dict:
|
|
51
53
|
"""
|
|
52
54
|
懂车帝用户作品列表
|
|
53
55
|
|
|
@@ -58,9 +60,10 @@ class DongchediAPI:
|
|
|
58
60
|
return self._client.post(
|
|
59
61
|
"/story/api/dongchedi/workList",
|
|
60
62
|
data={"userId": user_id, "cursor": cursor},
|
|
63
|
+
source=source,
|
|
61
64
|
)
|
|
62
65
|
|
|
63
|
-
def search_users(self, keyword: str, offset: int = 0) -> dict:
|
|
66
|
+
def search_users(self, keyword: str, offset: int = 0, source: str = "懂车帝关键词搜索账号-SDK") -> dict:
|
|
64
67
|
"""
|
|
65
68
|
懂车帝用户搜索
|
|
66
69
|
|
|
@@ -71,4 +74,5 @@ class DongchediAPI:
|
|
|
71
74
|
return self._client.post(
|
|
72
75
|
"/story/api/dongchedi/searchUser",
|
|
73
76
|
data={"keyword": keyword, "offset": offset},
|
|
77
|
+
source=source,
|
|
74
78
|
)
|
|
@@ -25,6 +25,7 @@ class DoubaoImageAPI:
|
|
|
25
25
|
watermark: bool = True,
|
|
26
26
|
optimize_prompt: bool = False,
|
|
27
27
|
optimize_mode: str = "standard",
|
|
28
|
+
source: str = "豆包 Seedream 5.0 Pro 图片生成-SDK",
|
|
28
29
|
) -> dict:
|
|
29
30
|
"""
|
|
30
31
|
提交 Seedream 5.0 Pro 图片生成任务
|
|
@@ -50,9 +51,9 @@ class DoubaoImageAPI:
|
|
|
50
51
|
data["image"] = image
|
|
51
52
|
if optimize_prompt:
|
|
52
53
|
data["optimizePromptOptions"] = {"mode": optimize_mode}
|
|
53
|
-
return self._client.post("/story/api/parseWork/imageGen/arkProSubmit", data=data)
|
|
54
|
+
return self._client.post("/story/api/parseWork/imageGen/arkProSubmit", data=data, source=source)
|
|
54
55
|
|
|
55
|
-
def pro_result(self, task_id: str) -> dict:
|
|
56
|
+
def pro_result(self, task_id: str, source: str = "查询 Seedream 5.0 Pro 任务结果-SDK") -> dict:
|
|
56
57
|
"""
|
|
57
58
|
查询 Seedream 5.0 Pro 任务结果
|
|
58
59
|
|
|
@@ -60,7 +61,7 @@ class DoubaoImageAPI:
|
|
|
60
61
|
:return: 任务结果字典
|
|
61
62
|
"""
|
|
62
63
|
return self._client.post(
|
|
63
|
-
"/story/api/parseWork/imageGen/arkProResult", data={"taskId": task_id}
|
|
64
|
+
"/story/api/parseWork/imageGen/arkProResult", data={"taskId": task_id}, source=source
|
|
64
65
|
)
|
|
65
66
|
|
|
66
67
|
# ─── Seedream 5.0 Lite ──────────────────────────────────
|
|
@@ -77,6 +78,7 @@ class DoubaoImageAPI:
|
|
|
77
78
|
max_images: int = 4,
|
|
78
79
|
optimize_prompt: bool = False,
|
|
79
80
|
optimize_mode: str = "standard",
|
|
81
|
+
source: str = "豆包 Seedream 5.0 Lite 图片生成-SDK",
|
|
80
82
|
) -> dict:
|
|
81
83
|
"""
|
|
82
84
|
提交 Seedream 5.0 Lite 图片生成任务
|
|
@@ -107,9 +109,9 @@ class DoubaoImageAPI:
|
|
|
107
109
|
data["sequentialImageGenerationOptions"] = {"maxImages": max_images}
|
|
108
110
|
if optimize_prompt:
|
|
109
111
|
data["optimizePromptOptions"] = {"mode": optimize_mode}
|
|
110
|
-
return self._client.post("/story/api/parseWork/imageGen/arkSubmit", data=data)
|
|
112
|
+
return self._client.post("/story/api/parseWork/imageGen/arkSubmit", data=data, source=source)
|
|
111
113
|
|
|
112
|
-
def lite_result(self, task_id: str) -> dict:
|
|
114
|
+
def lite_result(self, task_id: str, source: str = "查询 Seedream 5.0 Lite 任务结果-SDK") -> dict:
|
|
113
115
|
"""
|
|
114
116
|
查询 Seedream 5.0 Lite 任务结果
|
|
115
117
|
|
|
@@ -117,5 +119,5 @@ class DoubaoImageAPI:
|
|
|
117
119
|
:return: 任务结果字典
|
|
118
120
|
"""
|
|
119
121
|
return self._client.post(
|
|
120
|
-
"/story/api/parseWork/imageGen/arkResult", data={"taskId": task_id}
|
|
122
|
+
"/story/api/parseWork/imageGen/arkResult", data={"taskId": task_id}, source=source
|
|
121
123
|
)
|
|
@@ -24,6 +24,7 @@ class DoubaoVideoAPI:
|
|
|
24
24
|
watermark: bool = False,
|
|
25
25
|
generate_audio: bool = True,
|
|
26
26
|
return_last_frame: bool = False,
|
|
27
|
+
source: str = "豆包 Seedance 2.0 视频生成-SDK",
|
|
27
28
|
) -> dict:
|
|
28
29
|
"""
|
|
29
30
|
提交视频生成任务(Seedance 2.0)
|
|
@@ -58,10 +59,10 @@ class DoubaoVideoAPI:
|
|
|
58
59
|
if model is not None:
|
|
59
60
|
data["model"] = model
|
|
60
61
|
return self._client.post(
|
|
61
|
-
"/story/api/parseWork/videoGen/submit", data=data
|
|
62
|
+
"/story/api/parseWork/videoGen/submit", data=data, source=source
|
|
62
63
|
)
|
|
63
64
|
|
|
64
|
-
def result(self, task_id: str) -> dict:
|
|
65
|
+
def result(self, task_id: str, source: str = "查询豆包视频生成任务结果-SDK") -> dict:
|
|
65
66
|
"""
|
|
66
67
|
查询视频生成任务结果
|
|
67
68
|
|
|
@@ -71,4 +72,5 @@ class DoubaoVideoAPI:
|
|
|
71
72
|
return self._client.post(
|
|
72
73
|
"/story/api/parseWork/videoGen/result",
|
|
73
74
|
data={"taskId": task_id},
|
|
75
|
+
source=source,
|
|
74
76
|
)
|