redfox-python-sdk 0.1.0__tar.gz → 0.2.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 (24) hide show
  1. {redfox-python-sdk-0.1.0 → redfox-python-sdk-0.2.1}/PKG-INFO +1 -1
  2. {redfox-python-sdk-0.1.0 → redfox-python-sdk-0.2.1}/redfox/__init__.py +1 -1
  3. {redfox-python-sdk-0.1.0 → redfox-python-sdk-0.2.1}/redfox/client.py +26 -2
  4. redfox-python-sdk-0.2.1/redfox/endpoints/ai_search.py +87 -0
  5. redfox-python-sdk-0.2.1/redfox/endpoints/bilibili.py +123 -0
  6. redfox-python-sdk-0.2.1/redfox/endpoints/doubao_image.py +121 -0
  7. redfox-python-sdk-0.2.1/redfox/endpoints/doubao_video.py +74 -0
  8. redfox-python-sdk-0.2.1/redfox/endpoints/gpt_image.py +77 -0
  9. redfox-python-sdk-0.2.1/redfox/endpoints/tiktok.py +33 -0
  10. redfox-python-sdk-0.2.1/redfox/endpoints/toutiao.py +40 -0
  11. redfox-python-sdk-0.2.1/redfox/endpoints/wechat.py +159 -0
  12. redfox-python-sdk-0.2.1/redfox/endpoints/xiaohongshu.py +143 -0
  13. {redfox-python-sdk-0.1.0 → redfox-python-sdk-0.2.1}/redfox_python_sdk.egg-info/PKG-INFO +1 -1
  14. redfox-python-sdk-0.2.1/redfox_python_sdk.egg-info/SOURCES.txt +21 -0
  15. {redfox-python-sdk-0.1.0 → redfox-python-sdk-0.2.1}/setup.py +1 -1
  16. redfox-python-sdk-0.1.0/redfox_python_sdk.egg-info/SOURCES.txt +0 -12
  17. {redfox-python-sdk-0.1.0 → redfox-python-sdk-0.2.1}/README.md +0 -0
  18. {redfox-python-sdk-0.1.0 → redfox-python-sdk-0.2.1}/redfox/endpoints/__init__.py +0 -0
  19. {redfox-python-sdk-0.1.0 → redfox-python-sdk-0.2.1}/redfox/endpoints/douyin.py +0 -0
  20. {redfox-python-sdk-0.1.0 → redfox-python-sdk-0.2.1}/redfox/exceptions.py +0 -0
  21. {redfox-python-sdk-0.1.0 → redfox-python-sdk-0.2.1}/redfox_python_sdk.egg-info/dependency_links.txt +0 -0
  22. {redfox-python-sdk-0.1.0 → redfox-python-sdk-0.2.1}/redfox_python_sdk.egg-info/requires.txt +0 -0
  23. {redfox-python-sdk-0.1.0 → redfox-python-sdk-0.2.1}/redfox_python_sdk.egg-info/top_level.txt +0 -0
  24. {redfox-python-sdk-0.1.0 → redfox-python-sdk-0.2.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: redfox-python-sdk
3
- Version: 0.1.0
3
+ Version: 0.2.1
4
4
  Summary: RedFox 红狐数据平台 Python SDK
5
5
  Home-page: https://redfox.hk
6
6
  Author: RedFox
@@ -3,5 +3,5 @@
3
3
  from .client import RedFoxClient
4
4
  from .exceptions import RedFoxAPIError, RedFoxAuthError, RedFoxRateLimitError
5
5
 
6
- __version__ = "0.1.0"
6
+ __version__ = "0.2.1"
7
7
  __all__ = ["RedFoxClient", "RedFoxAPIError", "RedFoxAuthError", "RedFoxRateLimitError"]
@@ -5,6 +5,15 @@ from typing import Optional, Dict, Any
5
5
 
6
6
  from .exceptions import RedFoxAPIError, RedFoxAuthError, RedFoxRateLimitError
7
7
  from .endpoints.douyin import DouyinAPI
8
+ from .endpoints.xiaohongshu import XiaohongshuAPI
9
+ from .endpoints.wechat import WechatAPI
10
+ from .endpoints.bilibili import BilibiliAPI
11
+ from .endpoints.toutiao import ToutiaoAPI
12
+ from .endpoints.tiktok import TikTokAPI
13
+ from .endpoints.gpt_image import GPTImageAPI
14
+ from .endpoints.doubao_image import DoubaoImageAPI
15
+ from .endpoints.doubao_video import DoubaoVideoAPI
16
+ from .endpoints.ai_search import AISearchAPI
8
17
 
9
18
 
10
19
  class RedFoxClient:
@@ -20,8 +29,14 @@ class RedFoxClient:
20
29
  # 搜索抖音作品
21
30
  result = client.douyin.search_articles(keyword="AI")
22
31
 
23
- # 获取账号信息
24
- user = client.douyin.get_user(account_id="dy_user123")
32
+ # 搜索小红书作品
33
+ result = client.xiaohongshu.search_articles(keyword="AI")
34
+
35
+ # 搜索公众号文章
36
+ result = client.wechat.search_articles(keyword="AI")
37
+
38
+ # AI 搜索
39
+ task = client.ai_search.kimi_submit(inquiry_text="夏日茶饮推荐")
25
40
 
26
41
  :param api_key: RedFox API Key,在 https://redfox.hk/settings/api-keys?source=github 获取
27
42
  :param base_url: API 基础地址,默认 https://redfox.hk
@@ -54,6 +69,15 @@ class RedFoxClient:
54
69
 
55
70
  # 初始化各平台 API 模块
56
71
  self.douyin = DouyinAPI(self)
72
+ self.xiaohongshu = XiaohongshuAPI(self)
73
+ self.wechat = WechatAPI(self)
74
+ self.bilibili = BilibiliAPI(self)
75
+ self.toutiao = ToutiaoAPI(self)
76
+ self.tiktok = TikTokAPI(self)
77
+ self.gpt_image = GPTImageAPI(self)
78
+ self.doubao_image = DoubaoImageAPI(self)
79
+ self.doubao_video = DoubaoVideoAPI(self)
80
+ self.ai_search = AISearchAPI(self)
57
81
 
58
82
  def request(
59
83
  self,
@@ -0,0 +1,87 @@
1
+ """AI 搜索工具 API 端点"""
2
+
3
+ from typing import Optional, Dict, Any
4
+
5
+
6
+ class AISearchAPI:
7
+ """
8
+ AI 搜索工具 API 集合
9
+
10
+ 支持 Kimi、豆包、Deepseek 三种 AI 搜索引擎。
11
+ 每种引擎均为异步模式:先 submit 提交任务,再 result 查询结果。
12
+ """
13
+
14
+ def __init__(self, client):
15
+ self._client = client
16
+
17
+ # ─── Kimi ───────────────────────────────────────────────
18
+
19
+ def kimi_submit(self, inquiry_text: str) -> dict:
20
+ """
21
+ Kimi 纯文字搜索 - 提交任务
22
+
23
+ :param inquiry_text: 搜索文本(必填)
24
+ :return: 包含 taskId 的字典
25
+ """
26
+ return self._client.post(
27
+ "/story/api/kimi/submit", data={"inquiryText": inquiry_text}
28
+ )
29
+
30
+ def kimi_result(self, task_id: str) -> dict:
31
+ """
32
+ Kimi 纯文字搜索 - 查询任务结果
33
+
34
+ :param task_id: 任务 ID
35
+ :return: 任务结果字典,包含 completed/content/webPages
36
+ """
37
+ return self._client.post(
38
+ "/story/api/kimi/result", data={"taskId": task_id}
39
+ )
40
+
41
+ # ─── 豆包 ───────────────────────────────────────────────
42
+
43
+ def doubao_submit(self, inquiry_text: str) -> dict:
44
+ """
45
+ 豆包纯文字搜索 - 提交任务
46
+
47
+ :param inquiry_text: 搜索文本(必填)
48
+ :return: 包含 taskId 的字典
49
+ """
50
+ return self._client.post(
51
+ "/story/api/deepSearch/dbSubmit", data={"inquiryText": inquiry_text}
52
+ )
53
+
54
+ def doubao_result(self, task_id: str) -> dict:
55
+ """
56
+ 豆包纯文字搜索 - 查询任务结果
57
+
58
+ :param task_id: 任务 ID
59
+ :return: 任务结果字典
60
+ """
61
+ return self._client.post(
62
+ "/story/api/deepSearch/dbResult", data={"taskId": task_id}
63
+ )
64
+
65
+ # ─── Deepseek ───────────────────────────────────────────
66
+
67
+ def deepseek_submit(self, inquiry_text: str) -> dict:
68
+ """
69
+ Deepseek 纯文字搜索 - 提交任务
70
+
71
+ :param inquiry_text: 搜索文本(必填)
72
+ :return: 包含 taskId 的字典
73
+ """
74
+ return self._client.post(
75
+ "/story/api/deepSearch/dsSubmit", data={"inquiryText": inquiry_text}
76
+ )
77
+
78
+ def deepseek_result(self, task_id: str) -> dict:
79
+ """
80
+ Deepseek 纯文字搜索 - 查询任务结果
81
+
82
+ :param task_id: 任务 ID
83
+ :return: 任务结果字典
84
+ """
85
+ return self._client.post(
86
+ "/story/api/deepSearch/dsResult", data={"taskId": task_id}
87
+ )
@@ -0,0 +1,123 @@
1
+ """哔哩哔哩平台 API 端点"""
2
+
3
+ from typing import Optional, Dict, Any
4
+
5
+
6
+ class BilibiliAPI:
7
+ """
8
+ 哔哩哔哩平台 API 集合
9
+
10
+ 包含 B 站账号查询、作品搜索、作品详情等接口。
11
+ """
12
+
13
+ def __init__(self, client):
14
+ self._client = client
15
+
16
+ def get_account(self, mid: str) -> dict:
17
+ """
18
+ 获取哔哩哔哩账号信息(优质库)
19
+
20
+ :param mid: 账号 MID(B 站用户唯一 ID,必填)
21
+ :return: 账号信息字典
22
+ """
23
+ return self._client.post(
24
+ "/story/api/bili/data/accountDetail", data={"mid": mid}
25
+ )
26
+
27
+ def get_work(
28
+ self,
29
+ bvid: str = None,
30
+ work_url: str = None,
31
+ ) -> dict:
32
+ """
33
+ 获取哔哩哔哩作品内容详情(优质库)
34
+
35
+ bvid 和 work_url 至少传一个。
36
+
37
+ :param bvid: 作品 BV 号
38
+ :param work_url: 作品链接,支持 bilibili.com/video/BV1xxx 或 b23.tv 格式
39
+ :return: 作品详情字典
40
+ """
41
+ data: Dict[str, Any] = {}
42
+ if bvid:
43
+ data["bvId"] = bvid
44
+ if work_url:
45
+ data["workUrl"] = work_url
46
+ return self._client.post("/story/api/bili/data/workDetail", data=data)
47
+
48
+ def search_users(
49
+ self,
50
+ keyword: str,
51
+ page: int = 1,
52
+ page_size: int = None,
53
+ order: str = None,
54
+ ) -> dict:
55
+ """
56
+ 搜索关键词获取哔哩哔哩账号(优质库)
57
+
58
+ :param keyword: 搜索关键词(必填)
59
+ :param page: 页码,从 1 开始(必填)
60
+ :param page_size: 每页条数,默认 10,最大 50
61
+ :param order: 排序:follower=粉丝数 / like=获赞数,默认相关性
62
+ :return: 搜索结果字典
63
+ """
64
+ data: Dict[str, Any] = {"keyword": keyword, "page": str(page)}
65
+ if page_size is not None:
66
+ data["pageSize"] = page_size
67
+ if order is not None:
68
+ data["order"] = order
69
+ return self._client.post("/story/api/bili/data/accountSearch", data=data)
70
+
71
+ def search_articles(
72
+ self,
73
+ keyword: str,
74
+ page: int = 1,
75
+ page_size: int = None,
76
+ order: str = None,
77
+ ) -> dict:
78
+ """
79
+ 搜索关键词获取哔哩哔哩作品(优质库)
80
+
81
+ :param keyword: 搜索关键词(必填)
82
+ :param page: 页码,从 1 开始(必填)
83
+ :param page_size: 每页条数,默认 10,最大 50
84
+ :param order: 排序:time=发布时间 / play=播放数 / like=点赞数 / comment=评论数 / favorite=收藏数,默认 time
85
+ :return: 搜索结果字典
86
+ """
87
+ data: Dict[str, Any] = {"keyword": keyword, "page": str(page)}
88
+ if page_size is not None:
89
+ data["pageSize"] = page_size
90
+ if order is not None:
91
+ data["order"] = order
92
+ return self._client.post("/story/api/bili/data/workSearch", data=data)
93
+
94
+ def get_user_works(
95
+ self,
96
+ mid: str = None,
97
+ account_url: str = None,
98
+ page: int = 1,
99
+ page_size: int = None,
100
+ order: str = None,
101
+ ) -> dict:
102
+ """
103
+ 获取哔哩哔哩账号作品列表(优质库)
104
+
105
+ mid 和 account_url 至少传一个。
106
+
107
+ :param mid: 账号 MID
108
+ :param account_url: 主页链接,如 https://space.bilibili.com/946974
109
+ :param page: 页码,默认 1
110
+ :param page_size: 每页条数,默认 10,最大 50
111
+ :param order: 排序:time=发布时间 / play=播放数 / like=点赞数,默认 time
112
+ :return: 作品列表字典
113
+ """
114
+ data: Dict[str, Any] = {"page": str(page)}
115
+ if mid:
116
+ data["mid"] = mid
117
+ if account_url:
118
+ data["accountUrl"] = account_url
119
+ if page_size is not None:
120
+ data["pageSize"] = page_size
121
+ if order is not None:
122
+ data["order"] = order
123
+ return self._client.post("/story/api/bili/data/accountWorkList", data=data)
@@ -0,0 +1,121 @@
1
+ """豆包图片生成工具 API 端点"""
2
+
3
+ from typing import Optional, Dict, Any, Union, List
4
+
5
+
6
+ class DoubaoImageAPI:
7
+ """
8
+ 豆包图片生成工具 API 集合
9
+
10
+ 支持 Seedream 5.0 Pro 和 Seedream 5.0 Lite 两个模型。
11
+ """
12
+
13
+ def __init__(self, client):
14
+ self._client = client
15
+
16
+ # ─── Seedream 5.0 Pro ───────────────────────────────────
17
+
18
+ def pro_submit(
19
+ self,
20
+ prompt: str,
21
+ size: str = "2048x2048",
22
+ image: Union[str, List[str]] = None,
23
+ output_format: str = "jpeg",
24
+ response_format: str = "url",
25
+ watermark: bool = True,
26
+ optimize_prompt: bool = False,
27
+ optimize_mode: str = "standard",
28
+ ) -> dict:
29
+ """
30
+ 提交 Seedream 5.0 Pro 图片生成任务
31
+
32
+ :param prompt: 图片生成提示词(必填)
33
+ :param size: 尺寸,支持 1K/2K 或像素值如 "2048x2048"
34
+ :param image: 图生图输入图片,支持 URL 或 Base64
35
+ :param output_format: 输出格式,png/jpeg
36
+ :param response_format: 返回格式,url/b64_json
37
+ :param watermark: 是否添加 AI 生成水印
38
+ :param optimize_prompt: 是否开启提示词优化
39
+ :param optimize_mode: 优化模式,standard/fast
40
+ :return: 包含 taskId 的字典
41
+ """
42
+ data: Dict[str, Any] = {
43
+ "prompt": prompt,
44
+ "size": size,
45
+ "outputFormat": output_format,
46
+ "responseFormat": response_format,
47
+ "watermark": watermark,
48
+ }
49
+ if image is not None:
50
+ data["image"] = image
51
+ if optimize_prompt:
52
+ data["optimizePromptOptions"] = {"mode": optimize_mode}
53
+ return self._client.post("/story/api/parseWork/imageGen/arkProSubmit", data=data)
54
+
55
+ def pro_result(self, task_id: str) -> dict:
56
+ """
57
+ 查询 Seedream 5.0 Pro 任务结果
58
+
59
+ :param task_id: 任务 ID
60
+ :return: 任务结果字典
61
+ """
62
+ return self._client.post(
63
+ "/story/api/parseWork/imageGen/arkProResult", data={"taskId": task_id}
64
+ )
65
+
66
+ # ─── Seedream 5.0 Lite ──────────────────────────────────
67
+
68
+ def lite_submit(
69
+ self,
70
+ prompt: str,
71
+ size: str = "2048x2048",
72
+ image: Union[str, List[str]] = None,
73
+ output_format: str = "jpeg",
74
+ response_format: str = "url",
75
+ watermark: bool = True,
76
+ sequential: str = "disabled",
77
+ max_images: int = 4,
78
+ optimize_prompt: bool = False,
79
+ optimize_mode: str = "standard",
80
+ ) -> dict:
81
+ """
82
+ 提交 Seedream 5.0 Lite 图片生成任务
83
+
84
+ :param prompt: 图片生成提示词(必填)
85
+ :param size: 尺寸,支持 2K/3K/4K 或像素值
86
+ :param image: 图生图输入图片
87
+ :param output_format: 输出格式,png/jpeg
88
+ :param response_format: 返回格式,url/b64_json
89
+ :param watermark: 是否添加 AI 生成水印
90
+ :param sequential: 组图控制,auto/disabled
91
+ :param max_images: 组图最大数量,1~10
92
+ :param optimize_prompt: 是否开启提示词优化
93
+ :param optimize_mode: 优化模式,standard/fast
94
+ :return: 包含 taskId 的字典
95
+ """
96
+ data: Dict[str, Any] = {
97
+ "prompt": prompt,
98
+ "size": size,
99
+ "outputFormat": output_format,
100
+ "responseFormat": response_format,
101
+ "watermark": watermark,
102
+ "sequentialImageGeneration": sequential,
103
+ }
104
+ if image is not None:
105
+ data["image"] = image
106
+ if sequential == "auto":
107
+ data["sequentialImageGenerationOptions"] = {"maxImages": max_images}
108
+ if optimize_prompt:
109
+ data["optimizePromptOptions"] = {"mode": optimize_mode}
110
+ return self._client.post("/story/api/parseWork/imageGen/arkSubmit", data=data)
111
+
112
+ def lite_result(self, task_id: str) -> dict:
113
+ """
114
+ 查询 Seedream 5.0 Lite 任务结果
115
+
116
+ :param task_id: 任务 ID
117
+ :return: 任务结果字典
118
+ """
119
+ return self._client.post(
120
+ "/story/api/parseWork/imageGen/arkResult", data={"taskId": task_id}
121
+ )
@@ -0,0 +1,74 @@
1
+ """豆包视频生成 API 端点(Seedance 2.0)"""
2
+
3
+ from typing import Optional, Dict, Any, List
4
+
5
+
6
+ class DoubaoVideoAPI:
7
+ """
8
+ 豆包视频生成 API 集合(Seedance 2.0)
9
+
10
+ 包含视频生成任务提交与结果查询接口。
11
+ """
12
+
13
+ def __init__(self, client):
14
+ self._client = client
15
+
16
+ def submit(
17
+ self,
18
+ content: List[Dict[str, Any]],
19
+ model: str = None,
20
+ resolution: str = "720p",
21
+ ratio: str = "adaptive",
22
+ duration: int = 5,
23
+ seed: int = -1,
24
+ watermark: bool = False,
25
+ generate_audio: bool = True,
26
+ return_last_frame: bool = False,
27
+ ) -> dict:
28
+ """
29
+ 提交视频生成任务(Seedance 2.0)
30
+
31
+ content 是一个列表,每个元素是一个字典,支持以下 type:
32
+ - text: {"type": "text", "text": "描述文字"}
33
+ - image_url: {"type": "image_url", "imageUrl": "图片URL", "imageRole": "first_frame/reference_image"}
34
+ - video_url: {"type": "video_url", "videoUrl": "视频URL", "videoRole": "reference_video"}
35
+ - audio_url: {"type": "audio_url", "audioUrl": "音频URL", "audioRole": "reference_audio"}
36
+
37
+ :param content: 输入内容列表(必填),每项包含 type 及对应字段
38
+ :param model: 模型名称,如 "doubao-seedance-2-0-260128"
39
+ :param resolution: 视频分辨率:480p/720p/1080p(Seedance 2.0 fast 不支持 1080p)
40
+ :param ratio: 宽高比:adaptive/16:9/4:3/1:1/3:4/9:16/21:9
41
+ :param duration: 视频时长(秒),[4,15] 或 -1(智能)
42
+ :param seed: 随机种子,-1 为随机,范围 [-1, 2^32-1]
43
+ :param watermark: 是否添加水印
44
+ :param generate_audio: 是否生成同步音频(仅 Seedance 2.0 系列)
45
+ :param return_last_frame: 是否返回尾帧图像(用于连续视频生成)
46
+ :return: 含 taskId 的字典
47
+ """
48
+ data: Dict[str, Any] = {
49
+ "content": content,
50
+ "resolution": resolution,
51
+ "ratio": ratio,
52
+ "duration": duration,
53
+ "seed": seed,
54
+ "watermark": watermark,
55
+ "generateAudio": generate_audio,
56
+ "returnLastFrame": return_last_frame,
57
+ }
58
+ if model is not None:
59
+ data["model"] = model
60
+ return self._client.post(
61
+ "/story/api/parseWork/videoGen/submit", data=data
62
+ )
63
+
64
+ def result(self, task_id: str) -> dict:
65
+ """
66
+ 查询视频生成任务结果
67
+
68
+ :param task_id: 任务 ID(submit 接口返回)
69
+ :return: 视频生成结果字典
70
+ """
71
+ return self._client.post(
72
+ "/story/api/parseWork/videoGen/result",
73
+ data={"taskId": task_id},
74
+ )
@@ -0,0 +1,77 @@
1
+ """GPT 图片生成工具 API 端点"""
2
+
3
+ from typing import Optional, Dict, Any, List
4
+
5
+
6
+ class GPTImageAPI:
7
+ """
8
+ GPT 图片生成工具 API 集合
9
+
10
+ 支持文生图和图生图,基于 image2-GPT 模型。
11
+ """
12
+
13
+ def __init__(self, client):
14
+ self._client = client
15
+
16
+ def submit(
17
+ self,
18
+ prompt: str,
19
+ n: int = 1,
20
+ size: str = "1024x1024",
21
+ quality: str = "medium",
22
+ background: str = "auto",
23
+ output_format: str = "png",
24
+ output_compression: int = None,
25
+ model_name: str = "gpt-image-2",
26
+ operation: str = "generate",
27
+ input_fidelity: str = None,
28
+ images: List[Dict[str, str]] = None,
29
+ ) -> dict:
30
+ """
31
+ 提交 GPT 图片生成任务
32
+
33
+ :param prompt: 图片生成提示词(必填)
34
+ :param n: 生成数量,1~10
35
+ :param size: 图片尺寸,如 "1024x1024"
36
+ :param quality: 质量,支持 low/medium/high/auto
37
+ :param background: 背景类型,支持 transparent/opaque/auto
38
+ :param output_format: 输出格式,支持 png/jpeg/webp
39
+ :param output_compression: 输出压缩比,0~100
40
+ :param model_name: 模型名称,默认 gpt-image-2
41
+ :param operation: 操作类型,generate(文生图)/ edit(图生图)
42
+ :param input_fidelity: 输入图保真度,编辑模式(operation=edit)支持 high/low
43
+ :param images: 图片编辑输入图列表,operation=edit 时必填
44
+ :return: 包含 taskId 的字典
45
+ """
46
+ parameters: Dict[str, Any] = {
47
+ "modelName": model_name,
48
+ "n": n,
49
+ "size": size,
50
+ "quality": quality,
51
+ "background": background,
52
+ "outputFormat": output_format,
53
+ }
54
+ if output_compression is not None:
55
+ parameters["outputCompression"] = output_compression
56
+ if input_fidelity is not None:
57
+ parameters["inputFidelity"] = input_fidelity
58
+
59
+ data: Dict[str, Any] = {
60
+ "prompt": prompt,
61
+ "operation": operation,
62
+ "parameters": parameters,
63
+ }
64
+ if images is not None:
65
+ data["images"] = images
66
+ return self._client.post("/story/api/parseWork/imageGen/submitSkill", data=data)
67
+
68
+ def result(self, task_id: str) -> dict:
69
+ """
70
+ 查询 GPT 图片生成任务结果
71
+
72
+ :param task_id: 任务 ID(由 submit 接口返回)
73
+ :return: 任务结果字典,包含 status/imagePaths/failReason
74
+ """
75
+ return self._client.post(
76
+ "/story/api/parseWork/imageGen/result", data={"taskId": task_id}
77
+ )
@@ -0,0 +1,33 @@
1
+ """TikTok 平台 API 端点"""
2
+
3
+ from typing import Optional, Dict, Any
4
+
5
+
6
+ class TikTokAPI:
7
+ """
8
+ TikTok 平台 API 集合
9
+
10
+ 包含 TikTok 账号搜索等接口。
11
+ """
12
+
13
+ def __init__(self, client):
14
+ self._client = client
15
+
16
+ def search_users(
17
+ self,
18
+ keyword: str,
19
+ cursor: int = 0,
20
+ rid: str = None,
21
+ ) -> dict:
22
+ """
23
+ TikTok 关键词搜索账号
24
+
25
+ :param keyword: 搜索关键词(必填)
26
+ :param cursor: 翻页游标,第一页为 0,每页 +10
27
+ :param rid: 数据返回的 rid,翻页时传入,第一页传空
28
+ :return: 搜索结果字典,包含 cursor/hasMore/userList
29
+ """
30
+ data: Dict[str, Any] = {"keyword": keyword, "cursor": cursor}
31
+ if rid is not None:
32
+ data["rid"] = rid
33
+ return self._client.post("/story/api/deepSearch/tk/searchUser", data=data)
@@ -0,0 +1,40 @@
1
+ """今日头条平台 API 端点"""
2
+
3
+ from typing import Optional, Dict, Any
4
+
5
+
6
+ class ToutiaoAPI:
7
+ """
8
+ 今日头条平台 API 集合
9
+
10
+ 包含今日头条作品搜索、作品详情等接口(实时)。
11
+ """
12
+
13
+ def __init__(self, client):
14
+ self._client = client
15
+
16
+ def search_works(
17
+ self,
18
+ keyword: str,
19
+ offset: int = 0,
20
+ ) -> dict:
21
+ """
22
+ 获取今日头条账号作品列表(实时)
23
+
24
+ :param keyword: 搜索关键词(必填)
25
+ :param offset: 翻页偏移量,从 0 开始,每页 +1
26
+ :return: 作品列表
27
+ """
28
+ data: Dict[str, Any] = {"keyword": keyword, "offset": str(offset)}
29
+ return self._client.post("/story/api/toutiao/searchWork", data=data)
30
+
31
+ def get_work(self, opus_id: str) -> dict:
32
+ """
33
+ 获取今日头条作品内容详情(实时)
34
+
35
+ :param opus_id: 作品 ID(必填)
36
+ :return: 作品详情字典
37
+ """
38
+ return self._client.post(
39
+ "/story/api/toutiao/workDetail", data={"opusId": opus_id}
40
+ )
@@ -0,0 +1,159 @@
1
+ """微信公众号平台 API 端点"""
2
+
3
+ from typing import Optional, Dict, Any
4
+
5
+
6
+ class WechatAPI:
7
+ """
8
+ 微信公众号平台 API 集合
9
+
10
+ 包含公众号账号查询、作品搜索、文章详情等接口。
11
+ """
12
+
13
+ def __init__(self, client):
14
+ self._client = client
15
+
16
+ # ─── 账号相关 ───────────────────────────────────────────
17
+
18
+ def get_account(self, account: str, account_name: str = None) -> dict:
19
+ """
20
+ 获取公众号账号信息(优质库)
21
+
22
+ :param account: 公众号微信号(必填)
23
+ :param account_name: 公众号名称(可选)
24
+ :return: 账号信息字典
25
+ """
26
+ data: Dict[str, Any] = {"account": account}
27
+ if account_name is not None:
28
+ data["accountName"] = account_name
29
+ return self._client.post("/story/api/gzhData/queryUser", data=data)
30
+
31
+ def search_users(
32
+ self,
33
+ keyword: str,
34
+ offset: int = 0,
35
+ sort_type: str = None,
36
+ ) -> dict:
37
+ """
38
+ 搜索关键词获取公众号账号(优质库)
39
+
40
+ :param keyword: 搜索关键词(必填)
41
+ :param offset: 偏移量,从 0 开始,每页 +20
42
+ :param sort_type: 排序方式:_0=默认,_2=最新,_4=最热
43
+ :return: 搜索结果字典
44
+ """
45
+ data: Dict[str, Any] = {"keyword": keyword}
46
+ if offset is not None:
47
+ data["offset"] = offset
48
+ if sort_type is not None:
49
+ data["sortType"] = sort_type
50
+ return self._client.post("/story/api/gzhData/searchUser", data=data)
51
+
52
+ # ─── 作品相关 ───────────────────────────────────────────
53
+
54
+ def get_work(self, work_uuid: str) -> dict:
55
+ """
56
+ 根据作品 UUID 获取公众号作品(优质库)
57
+
58
+ :param work_uuid: 作品 UUID(必填)
59
+ :return: 作品详情字典
60
+ """
61
+ return self._client.post(
62
+ "/story/api/gzhData/queryWork", data={"workUuid": work_uuid}
63
+ )
64
+
65
+ def get_article_detail(self, url: str) -> dict:
66
+ """
67
+ 根据作品地址获取公众号文章(优质库)
68
+
69
+ :param url: 文章链接(必填)
70
+ :return: 文章详情字典
71
+ """
72
+ return self._client.post(
73
+ "/story/api/gzhData/queryArticleDetail", data={"url": url}
74
+ )
75
+
76
+ def search_articles(
77
+ self,
78
+ keyword: str,
79
+ offset: int = 0,
80
+ sort_type: str = None,
81
+ ) -> dict:
82
+ """
83
+ 搜索关键词获取公众号作品(优质库)
84
+
85
+ :param keyword: 搜索关键词(必填)
86
+ :param offset: 偏移量,从 0 开始,每页 +20
87
+ :param sort_type: 排序方式
88
+ :return: 搜索结果字典
89
+ """
90
+ data: Dict[str, Any] = {"keyword": keyword}
91
+ if offset is not None:
92
+ data["offset"] = offset
93
+ if sort_type is not None:
94
+ data["sortType"] = sort_type
95
+ return self._client.post("/story/api/gzhData/searchArticle", data=data)
96
+
97
+ def get_user_works(
98
+ self,
99
+ account: str,
100
+ account_name: str = None,
101
+ offset: int = 0,
102
+ sort_type: str = None,
103
+ publish_time_start: str = None,
104
+ publish_time_end: str = None,
105
+ ) -> dict:
106
+ """
107
+ 获取公众号账号作品列表(优质库)
108
+
109
+ :param account: 公众号微信号(必填)
110
+ :param account_name: 公众号名称(可选)
111
+ :param offset: 偏移量,从 0 开始,每页 +20
112
+ :param sort_type: 排序方式:_0=默认,_2=最新,_4=最热
113
+ :param publish_time_start: 发布时间起始,最早 2026-04-01,不传默认 2026-04-01
114
+ :param publish_time_end: 发布时间结束,不传默认当前时间
115
+ :return: 作品列表字典
116
+ """
117
+ data: Dict[str, Any] = {"account": account}
118
+ if account_name:
119
+ data["accountName"] = account_name
120
+ if offset is not None:
121
+ data["offset"] = offset
122
+ if sort_type is not None:
123
+ data["sortType"] = sort_type
124
+ if publish_time_start is not None:
125
+ data["publishTimeStart"] = publish_time_start
126
+ if publish_time_end is not None:
127
+ data["publishTimeEnd"] = publish_time_end
128
+ return self._client.post("/story/api/gzhData/queryWorkList", data=data)
129
+
130
+ # ─── AI 作品 ────────────────────────────────────────────
131
+
132
+ def search_ai_articles(
133
+ self,
134
+ keyword: str,
135
+ page_num: int = 1,
136
+ page_size: int = 20,
137
+ start_time: str = None,
138
+ end_time: str = None,
139
+ ) -> dict:
140
+ """
141
+ 搜索关键词获取公众号 AI 创作作品(优质库)
142
+
143
+ :param keyword: 搜索关键词(必填)
144
+ :param page_num: 页码,默认 1(必填)
145
+ :param page_size: 每页条数,默认 20(必填)
146
+ :param start_time: 开始时间,格式 "2026-06-01 00:00:00"
147
+ :param end_time: 结束时间,格式 "2026-06-01 23:59:59"
148
+ :return: 搜索结果字典
149
+ """
150
+ data: Dict[str, Any] = {
151
+ "keyword": keyword,
152
+ "pageNum": page_num,
153
+ "pageSize": page_size,
154
+ }
155
+ if start_time is not None:
156
+ data["startTime"] = start_time
157
+ if end_time is not None:
158
+ data["endTime"] = end_time
159
+ return self._client.post("/story/api/parseWork/queryAiMsgs", data=data)
@@ -0,0 +1,143 @@
1
+ """小红书平台 API 端点"""
2
+
3
+ from typing import Optional, Dict, Any
4
+
5
+
6
+ class XiaohongshuAPI:
7
+ """
8
+ 小红书平台 API 集合
9
+
10
+ 包含小红书账号查询、作品搜索、笔记详情等接口。
11
+ """
12
+
13
+ def __init__(self, client):
14
+ self._client = client
15
+
16
+ # ─── 账号相关 ───────────────────────────────────────────
17
+
18
+ def search_users(
19
+ self,
20
+ keyword: str,
21
+ offset: int = 0,
22
+ sort_type: str = None,
23
+ ) -> dict:
24
+ """
25
+ 搜索关键词获取小红书账号(优质库)
26
+
27
+ :param keyword: 搜索关键词(必填)
28
+ :param offset: 偏移量
29
+ :param sort_type: 排序方式
30
+ :return: 搜索结果字典
31
+ """
32
+ data: Dict[str, Any] = {"keyword": keyword}
33
+ if offset is not None:
34
+ data["offset"] = offset
35
+ if sort_type is not None:
36
+ data["sortType"] = sort_type
37
+ return self._client.post(
38
+ "/story/api/redBookData/searchUser", data=data
39
+ )
40
+
41
+ def get_account(
42
+ self,
43
+ account_id: str,
44
+ user_id: str = None,
45
+ ) -> dict:
46
+ """
47
+ 获取小红书账号信息(优质库)
48
+
49
+ :param account_id: 小红书号(必填)
50
+ :param user_id: 用户 ID(可选)
51
+ :return: 账号信息字典
52
+ """
53
+ data: Dict[str, Any] = {"accountId": account_id}
54
+ if user_id is not None:
55
+ data["userId"] = user_id
56
+ return self._client.post(
57
+ "/story/api/redBookData/queryUser", data=data
58
+ )
59
+
60
+ # ─── 作品相关 ───────────────────────────────────────────
61
+
62
+ def search_articles(
63
+ self,
64
+ keyword: str,
65
+ offset: int = 0,
66
+ sort_type: str = None,
67
+ ) -> dict:
68
+ """
69
+ 搜索关键词获取小红书作品(优质库)
70
+
71
+ :param keyword: 搜索关键词(必填)
72
+ :param offset: 偏移量
73
+ :param sort_type: 排序方式
74
+ :return: 搜索结果字典
75
+ """
76
+ data: Dict[str, Any] = {"keyword": keyword}
77
+ if offset is not None:
78
+ data["offset"] = offset
79
+ if sort_type is not None:
80
+ data["sortType"] = sort_type
81
+ return self._client.post(
82
+ "/story/api/redBookData/searchArticle", data=data
83
+ )
84
+
85
+ def get_work(
86
+ self,
87
+ work_id: str = None,
88
+ work_link: str = None,
89
+ ) -> dict:
90
+ """
91
+ 获取小红书作品内容详情(优质库)
92
+
93
+ work_id 和 work_link 至少传一个。
94
+
95
+ :param work_id: 作品 ID
96
+ :param work_link: 作品链接,如 https://www.xiaohongshu.com/explore/xxx
97
+ :return: 作品详情字典
98
+ """
99
+ data: Dict[str, Any] = {}
100
+ if work_id:
101
+ data["workId"] = work_id
102
+ if work_link:
103
+ data["workLink"] = work_link
104
+ return self._client.post(
105
+ "/story/api/redBookData/queryWork", data=data
106
+ )
107
+
108
+ # ─── AI 作品 ────────────────────────────────────────────
109
+
110
+ def search_ai_articles(
111
+ self,
112
+ keyword: str,
113
+ page_num: int = 1,
114
+ page_size: int = 20,
115
+ start_time: str = None,
116
+ end_time: str = None,
117
+ source: str = None,
118
+ ) -> dict:
119
+ """
120
+ 搜索关键词获取小红书 AI 创作作品(优质库)
121
+
122
+ :param keyword: 搜索关键词(必填)
123
+ :param page_num: 页码,默认 1
124
+ :param page_size: 每页条数,默认 20
125
+ :param start_time: 起始时间,格式 "2026-06-01 00:00:00"
126
+ :param end_time: 结束时间,格式 "2026-06-02 00:00:00"
127
+ :param source: 来源平台(可选)
128
+ :return: 搜索结果字典
129
+ """
130
+ data: Dict[str, Any] = {
131
+ "keyword": keyword,
132
+ "pageNum": page_num,
133
+ "pageSize": page_size,
134
+ }
135
+ if start_time is not None:
136
+ data["startTime"] = start_time
137
+ if end_time is not None:
138
+ data["endTime"] = end_time
139
+ if source is not None:
140
+ data["source"] = source
141
+ return self._client.post(
142
+ "/story/api/parseWork/queryAiMsgs", data=data
143
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: redfox-python-sdk
3
- Version: 0.1.0
3
+ Version: 0.2.1
4
4
  Summary: RedFox 红狐数据平台 Python SDK
5
5
  Home-page: https://redfox.hk
6
6
  Author: RedFox
@@ -0,0 +1,21 @@
1
+ README.md
2
+ setup.py
3
+ redfox/__init__.py
4
+ redfox/client.py
5
+ redfox/exceptions.py
6
+ redfox/endpoints/__init__.py
7
+ redfox/endpoints/ai_search.py
8
+ redfox/endpoints/bilibili.py
9
+ redfox/endpoints/doubao_image.py
10
+ redfox/endpoints/doubao_video.py
11
+ redfox/endpoints/douyin.py
12
+ redfox/endpoints/gpt_image.py
13
+ redfox/endpoints/tiktok.py
14
+ redfox/endpoints/toutiao.py
15
+ redfox/endpoints/wechat.py
16
+ redfox/endpoints/xiaohongshu.py
17
+ redfox_python_sdk.egg-info/PKG-INFO
18
+ redfox_python_sdk.egg-info/SOURCES.txt
19
+ redfox_python_sdk.egg-info/dependency_links.txt
20
+ redfox_python_sdk.egg-info/requires.txt
21
+ redfox_python_sdk.egg-info/top_level.txt
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="redfox-python-sdk",
5
- version="0.1.0",
5
+ version="0.2.1",
6
6
  description="RedFox 红狐数据平台 Python SDK",
7
7
  long_description=open("README.md", encoding="utf-8").read(),
8
8
  long_description_content_type="text/markdown",
@@ -1,12 +0,0 @@
1
- README.md
2
- setup.py
3
- redfox/__init__.py
4
- redfox/client.py
5
- redfox/exceptions.py
6
- redfox/endpoints/__init__.py
7
- redfox/endpoints/douyin.py
8
- redfox_python_sdk.egg-info/PKG-INFO
9
- redfox_python_sdk.egg-info/SOURCES.txt
10
- redfox_python_sdk.egg-info/dependency_links.txt
11
- redfox_python_sdk.egg-info/requires.txt
12
- redfox_python_sdk.egg-info/top_level.txt