justoneapi 1.0.0__py3-none-any.whl

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.
justoneapi/__init__.py ADDED
@@ -0,0 +1,2 @@
1
+ __version__ = "1.0.0"
2
+
File without changes
@@ -0,0 +1,82 @@
1
+ from justoneapi import config
2
+ from justoneapi.apis import request_util
3
+ from justoneapi.log import logger
4
+
5
+
6
+ class BilibiliAPI:
7
+ def __init__(self, token):
8
+ self.token = token
9
+
10
+ def get_video_detail_v2(self, bvid: str):
11
+ url = f"{config.BASE_URL}/api/bilibili/get-video-detail/v2"
12
+ params = {
13
+ "token": self.token,
14
+ "bvid": bvid,
15
+ }
16
+ return request_util.get_request(url, params)
17
+
18
+ def get_user_video_list_v2(self, uid: str, aid: str = None):
19
+ url = f"{config.BASE_URL}/api/bilibili/get-user-video-list/v2"
20
+ params = {
21
+ "token": self.token,
22
+ "uid": uid,
23
+ }
24
+ if aid:
25
+ params["aid"] = aid
26
+
27
+ has_next_page = False
28
+ result, data, message = request_util.get_request_page(url, params)
29
+ try:
30
+ if data:
31
+ if data.get("data", {}).get("has_next", False) is True:
32
+ has_next_page = True
33
+ except Exception as e:
34
+ logger.warning(f"Pagination parse error at {url}. Contact us to fix it.")
35
+ return result, data, message, has_next_page
36
+
37
+ def get_user_detail_v2(self, uid: str):
38
+ url = f"{config.BASE_URL}/api/bilibili/get-user-detail/v2"
39
+ params = {
40
+ "token": self.token,
41
+ "uid": uid,
42
+ }
43
+ return request_util.get_request(url, params)
44
+
45
+ def get_video_comment_v2(self, aid: str, cursor: str = None):
46
+ url = f"{config.BASE_URL}/api/bilibili/get-video-comment/v2"
47
+ params = {
48
+ "token": self.token,
49
+ "aid": aid,
50
+ }
51
+ if cursor:
52
+ params["cursor"] = cursor
53
+
54
+ has_next_page = False
55
+ result, data, message = request_util.get_request_page(url, params)
56
+ try:
57
+ if data:
58
+ if data.get("data", {}).get("has_next", False) is True:
59
+ has_next_page = True
60
+ except Exception as e:
61
+ logger.warning(f"Pagination parse error at {url}. Contact us to fix it.")
62
+ return result, data, message, has_next_page
63
+
64
+ def search_video_v2(self, keyword: str, page: int):
65
+ url = f"{config.BASE_URL}/api/bilibili/search-video/v2"
66
+ params = {
67
+ "token": self.token,
68
+ "keyword": keyword,
69
+ "page": page,
70
+ }
71
+
72
+ has_next_page = False
73
+ result, data, message = request_util.get_request_page(url, params)
74
+ try:
75
+ if data:
76
+ if data.get("data", {}).get("result"):
77
+ if page < data.get("data", {}).get("numPages", 0):
78
+ has_next_page = True
79
+ except Exception as e:
80
+ logger.warning(f"Pagination parse error at {url}. Contact us to fix it.")
81
+ return result, data, message, has_next_page
82
+
@@ -0,0 +1,121 @@
1
+ from justoneapi import config
2
+ from justoneapi.apis import request_util
3
+ from justoneapi.log import logger
4
+
5
+
6
+ class DouyinAPI:
7
+ def __init__(self, token):
8
+ self.token = token
9
+
10
+ def get_user_detail_v3(self, sec_uid: str):
11
+ url = f"{config.BASE_URL}/api/douyin/get-user-detail/v3"
12
+ params = {
13
+ "token": self.token,
14
+ "secUid": sec_uid,
15
+ }
16
+ return request_util.get_request(url, params)
17
+
18
+ def get_user_video_list_v3(self, sec_uid: str, max_cursor: int):
19
+ url = f"{config.BASE_URL}/api/douyin/get-user-video-list/v3"
20
+ params = {
21
+ "token": self.token,
22
+ "secUid": sec_uid,
23
+ "maxCursor": max_cursor,
24
+ }
25
+
26
+ has_next_page = False
27
+ result, data, message = request_util.get_request_page(url, params)
28
+ try:
29
+ if data:
30
+ if data.get("has_more") == 1:
31
+ has_next_page = True
32
+ except Exception as e:
33
+ logger.warning(f"Pagination parse error at {url}. Contact us to fix it.")
34
+ return result, data, message, has_next_page
35
+
36
+ def get_video_detail_v2(self, video_id: str):
37
+ url = f"{config.BASE_URL}/api/douyin/get-video-detail/v2"
38
+ params = {
39
+ "token": self.token,
40
+ "videoId": video_id,
41
+ }
42
+ return request_util.get_request(url, params)
43
+
44
+ def search_video_v4(self, keyword: str, sort_type: str, publish_time: str, duration: str, page: int, search_id: str = None):
45
+ url = f"{config.BASE_URL}/api/douyin/search-video/v4"
46
+ params = {
47
+ "token": self.token,
48
+ "keyword": keyword,
49
+ "sortType": sort_type,
50
+ "publishTime": publish_time,
51
+ "duration": duration,
52
+ "page": page,
53
+ }
54
+ if search_id:
55
+ params["searchId"] = search_id
56
+
57
+ has_next_page = False
58
+ result, data, message = request_util.get_request_page(url, params)
59
+ try:
60
+ if data:
61
+ if data.get("business_config", {}).get("has_more", 0) == 1:
62
+ has_next_page = True
63
+ except Exception as e:
64
+ logger.warning(f"Pagination parse error at {url}. Contact us to fix it.")
65
+ return result, data, message, has_next_page
66
+
67
+ def search_user_v2(self, keyword: str, page: int, user_type: str = None):
68
+ url = f"{config.BASE_URL}/api/douyin/search-user/v2"
69
+ params = {
70
+ "token": self.token,
71
+ "keyword": keyword,
72
+ "page": page,
73
+ }
74
+ if user_type:
75
+ params["userType"] = user_type
76
+
77
+ has_next_page = False
78
+ result, data, message = request_util.get_request_page(url, params)
79
+ try:
80
+ if data:
81
+ if data.get("business_config", {}).get("has_more", 0) == 1:
82
+ has_next_page = True
83
+ except Exception as e:
84
+ logger.warning(f"Pagination parse error at {url}. Contact us to fix it.")
85
+ return result, data, message, has_next_page
86
+
87
+ def get_video_comment_v1(self, aweme_id: str, page: int):
88
+ url = f"{config.BASE_URL}/api/douyin/get-video-comment/v1"
89
+ params = {
90
+ "token": self.token,
91
+ "awemeId": aweme_id,
92
+ "page": page,
93
+ }
94
+
95
+ has_next_page = False
96
+ result, data, message = request_util.get_request_page(url, params)
97
+ try:
98
+ if data:
99
+ if data.get("has_more") == 1:
100
+ has_next_page = True
101
+ except Exception as e:
102
+ logger.warning(f"Pagination parse error at {url}. Contact us to fix it.")
103
+ return result, data, message, has_next_page
104
+
105
+ def get_video_sub_comment_v1(self, comment_id: str, page: int):
106
+ url = f"{config.BASE_URL}/api/douyin/get-video-sub-comment/v1"
107
+ params = {
108
+ "token": self.token,
109
+ "commentId": comment_id,
110
+ "page": page,
111
+ }
112
+
113
+ has_next_page = False
114
+ result, data, message = request_util.get_request_page(url, params)
115
+ try:
116
+ if data:
117
+ if data.get("has_more") == 1:
118
+ has_next_page = True
119
+ except Exception as e:
120
+ logger.warning(f"Pagination parse error at {url}. Contact us to fix it.")
121
+ return result, data, message, has_next_page
@@ -0,0 +1,80 @@
1
+ from justoneapi import config
2
+ from justoneapi.apis import request_util
3
+ from justoneapi.log import logger
4
+
5
+
6
+ class KuaishouAPI:
7
+ def __init__(self, token):
8
+ self.token = token
9
+
10
+ def search_user_v2(self, keyword: str, page: int):
11
+ url = f"{config.BASE_URL}/api/kuaishou/search-user/v2"
12
+ params = {
13
+ "token": self.token,
14
+ "keyword": keyword,
15
+ "page": page,
16
+ }
17
+
18
+ has_next_page = False
19
+ result, data, message = request_util.get_request_page(url, params)
20
+ try:
21
+ if data:
22
+ if data.get("users"):
23
+ has_next_page = True
24
+ except Exception as e:
25
+ logger.warning(f"Pagination parse error at {url}. Contact us to fix it.")
26
+ return result, data, message, has_next_page
27
+
28
+ def get_user_video_list_v2(self, user_id: str, pcursor: str = None):
29
+ url = f"{config.BASE_URL}/api/kuaishou/get-user-video-list/v2"
30
+ params = {
31
+ "token": self.token,
32
+ "userId": user_id,
33
+ }
34
+ if pcursor:
35
+ params["pcursor"] = pcursor
36
+
37
+ has_next_page = False
38
+ result, data, message = request_util.get_request_page(url, params)
39
+ try:
40
+ if data:
41
+ if data.get("feeds"):
42
+ has_next_page = True
43
+ except Exception as e:
44
+ logger.warning(f"Pagination parse error at {url}. Contact us to fix it.")
45
+ return result, data, message, has_next_page
46
+
47
+ def get_video_detail_v2(self, video_id: str):
48
+ url = f"{config.BASE_URL}/api/kuaishou/get-video-detail/v2"
49
+ params = {
50
+ "token": self.token,
51
+ "videoId": video_id,
52
+ }
53
+ return request_util.get_request(url, params)
54
+
55
+ def search_video_v2(self, keyword: str, page: int):
56
+ url = f"{config.BASE_URL}/api/kuaishou/search-video/v2"
57
+ params = {
58
+ "token": self.token,
59
+ "keyword": keyword,
60
+ "page": page,
61
+ }
62
+
63
+ has_next_page = False
64
+ result, data, message = request_util.get_request_page(url, params)
65
+ try:
66
+ if data:
67
+ if data.get("feeds"):
68
+ has_next_page = True
69
+ except Exception as e:
70
+ logger.warning(f"Pagination parse error at {url}. Contact us to fix it.")
71
+ return result, data, message, has_next_page
72
+
73
+ def get_user_detail_v2(self, user_id: str):
74
+ url = f"{config.BASE_URL}/api/kuaishou/get-user-detail/v1"
75
+ params = {
76
+ "token": self.token,
77
+ "userId": user_id,
78
+ }
79
+ return request_util.get_request(url, params)
80
+
@@ -0,0 +1,58 @@
1
+ import requests
2
+ from justoneapi import __version__
3
+
4
+ from justoneapi.log import logger
5
+
6
+
7
+ def _request(method: str, url: str, params: dict, timeout: int) -> requests.Response:
8
+ headers = {
9
+ "JUSTONEAPI_PYTHON_SKD_VERSION": __version__,
10
+ }
11
+ response = requests.request(method, url, params=params, timeout=timeout, headers=headers)
12
+
13
+ log_message = response.headers.get("JUSTONEAPI_PYTHON_SDK_LOG_MESSAGE")
14
+ if log_message:
15
+ logger.warning(log_message)
16
+ version_deprecated = response.headers.get("JUSTONEAPI_PYTHON_SDK_VERSION_DEPRECATED")
17
+ if version_deprecated:
18
+ raise RuntimeError(f"JustoneAPI Python SDK version {__version__} is deprecated, please update to the latest version.")
19
+
20
+ return response
21
+
22
+
23
+ def get_request(url: str, params: dict):
24
+ try:
25
+ response_data = _request(method="GET", url=url, params=params, timeout=60).json()
26
+ code = response_data["code"]
27
+ data = response_data["data"]
28
+ message = response_data["message"]
29
+
30
+ if code == 0:
31
+ return True, data, message
32
+ if str(code).startswith('2'):
33
+ return True, data, message
34
+ return False, data, message
35
+ except RuntimeError as re:
36
+ raise re
37
+ except Exception as e:
38
+ logger.exception(e)
39
+ return False, None, "request error"
40
+
41
+
42
+ def get_request_page(url: str, params: dict):
43
+ try:
44
+ response_data = _request(method="GET", url=url, params=params, timeout=60).json()
45
+ code = response_data["code"]
46
+ data = response_data["data"]
47
+ message = response_data["message"]
48
+
49
+ if code == 0:
50
+ return True, data, message
51
+ if str(code).startswith('2'):
52
+ return True, data, message
53
+ return False, data, message
54
+ except RuntimeError as re:
55
+ raise re
56
+ except Exception as e:
57
+ logger.exception(e)
58
+ return False, None, "request error"
@@ -0,0 +1,158 @@
1
+ from justoneapi import config
2
+ from justoneapi.apis import request_util
3
+ from justoneapi.log import logger
4
+
5
+
6
+ class TaobaoAPI:
7
+ def __init__(self, token):
8
+ self.token = token
9
+
10
+ def get_item_detail_v1(self, item_id: str):
11
+ url = f"{config.BASE_URL}/api/taobao/get-item-detail/v1"
12
+ params = {
13
+ "token": self.token,
14
+ "itemId": item_id,
15
+ }
16
+ return request_util.get_request(url, params)
17
+
18
+ def get_item_detail_v2(self, item_id: str):
19
+ url = f"{config.BASE_URL}/api/taobao/get-item-detail/v2"
20
+ params = {
21
+ "token": self.token,
22
+ "itemId": item_id,
23
+ }
24
+ return request_util.get_request(url, params)
25
+
26
+ def get_item_detail_v3(self, item_id: str):
27
+ url = f"{config.BASE_URL}/api/taobao/get-item-detail/v3"
28
+ params = {
29
+ "token": self.token,
30
+ "itemId": item_id,
31
+ }
32
+ return request_util.get_request(url, params)
33
+
34
+ def get_item_detail_v4(self, item_id: str):
35
+ url = f"{config.BASE_URL}/api/taobao/get-item-detail/v4"
36
+ params = {
37
+ "token": self.token,
38
+ "itemId": item_id,
39
+ }
40
+ return request_util.get_request(url, params)
41
+
42
+ def get_item_detail_v5(self, item_id: str):
43
+ url = f"{config.BASE_URL}/api/taobao/get-item-detail/v5"
44
+ params = {
45
+ "token": self.token,
46
+ "itemId": item_id,
47
+ }
48
+ return request_util.get_request(url, params)
49
+
50
+ def get_item_comment_v6(self, item_id: str, page: int, order_type: str = None):
51
+ url = f"{config.BASE_URL}/api/taobao/get-item-comment/v6"
52
+ params = {
53
+ "token": self.token,
54
+ "itemId": item_id,
55
+ "page": page,
56
+ }
57
+ if order_type:
58
+ params["orderType"] = order_type
59
+
60
+ has_next_page = False
61
+ result, data, message = request_util.get_request_page(url, params)
62
+ try:
63
+ if data:
64
+ if page < data.get("paginator", {}).get("lastPage", -1):
65
+ has_next_page = True
66
+ except Exception as e:
67
+ logger.warning(f"Pagination parse error at {url}. Contact us to fix it.")
68
+ return result, data, message, has_next_page
69
+
70
+ def get_item_comment_v7(self, item_id: str, page: int, order_type: str = None):
71
+ url = f"{config.BASE_URL}/api/taobao/get-item-comment/v7"
72
+ params = {
73
+ "token": self.token,
74
+ "itemId": item_id,
75
+ "page": page,
76
+ }
77
+ if order_type:
78
+ params["orderType"] = order_type
79
+
80
+ has_next_page = False
81
+ result, data, message = request_util.get_request_page(url, params)
82
+ try:
83
+ if data:
84
+ if data.get("hasNext", "false") == "true":
85
+ has_next_page = True
86
+ except Exception as e:
87
+ logger.warning(f"Pagination parse error at {url}. Contact us to fix it.")
88
+ return result, data, message, has_next_page
89
+
90
+ def get_social_feed_v1(self, item_id: str, page: int):
91
+ url = f"{config.BASE_URL}/api/taobao/get-social-feed/v1"
92
+ params = {
93
+ "token": self.token,
94
+ "itemId": item_id,
95
+ "page": page,
96
+ }
97
+
98
+ has_next_page = False
99
+ result, data, message = request_util.get_request_page(url, params)
100
+ try:
101
+ if data:
102
+ if data.get("pagination", {}).get("hasMore", "false") == "true":
103
+ has_next_page = True
104
+ except Exception as e:
105
+ logger.warning(f"Pagination parse error at {url}. Contact us to fix it.")
106
+ return result, data, message, has_next_page
107
+
108
+ def get_shop_item_list_v9(self, user_id: str, shop_id: str, sort: str, page: int):
109
+ url = f"{config.BASE_URL}/api/taobao/get-shop-item-list/v9"
110
+ params = {
111
+ "token": self.token,
112
+ "userId": user_id,
113
+ "shopId": shop_id,
114
+ "sort": sort,
115
+ "page": page,
116
+ }
117
+
118
+ has_next_page = False
119
+ result, data, message = request_util.get_request_page(url, params)
120
+ try:
121
+ if data:
122
+ if data.get("itemsArray"):
123
+ if page < int(data.get("totalPage", '0')):
124
+ has_next_page = True
125
+ except Exception as e:
126
+ logger.warning(f"Pagination parse error at {url}. Contact us to fix it.")
127
+ return result, data, message, has_next_page
128
+
129
+ def get_item_sale_v5(self, item_id: str):
130
+ url = f"{config.BASE_URL}/api/taobao/get-item-sale/v5"
131
+ params = {
132
+ "token": self.token,
133
+ "itemId": item_id,
134
+ }
135
+ return request_util.get_request(url, params)
136
+
137
+ def search_item_list_v6(self, keyword: str, sort: str, page: int, tab: str = None):
138
+ url = f"{config.BASE_URL}/api/taobao/search-item-list/v6"
139
+ params = {
140
+ "token": self.token,
141
+ "keyword": keyword,
142
+ "sort": sort,
143
+ "page": page,
144
+ }
145
+ if tab:
146
+ params["tab"] = tab
147
+
148
+ has_next_page = False
149
+ result, data, message = request_util.get_request_page(url, params)
150
+ try:
151
+ if data:
152
+ if data.get("itemsArray"):
153
+ if page < int(data.get("totalPage", '0')):
154
+ has_next_page = True
155
+ except Exception as e:
156
+ logger.warning(f"Pagination parse error at {url}. Contact us to fix it.")
157
+ return result, data, message, has_next_page
158
+
@@ -0,0 +1,23 @@
1
+ from justoneapi import config
2
+ from justoneapi.apis import request_util
3
+
4
+
5
+ class UserAPI:
6
+ def __init__(self, token):
7
+ self.token = token
8
+
9
+ def get_balance(self):
10
+ url = f"{config.BASE_URL}/user/get-balance"
11
+ params = {
12
+ "token": self.token,
13
+ }
14
+ return request_util.get_request(url, params)
15
+
16
+ def get_record(self, order_year: int, order_month: int):
17
+ url = f"{config.BASE_URL}/user/get-record"
18
+ params = {
19
+ "token": self.token,
20
+ "orderYear": order_year,
21
+ "orderMonth": order_month,
22
+ }
23
+ return request_util.get_request(url, params)
@@ -0,0 +1,57 @@
1
+ from justoneapi import config
2
+ from justoneapi.apis import request_util
3
+ from justoneapi.log import logger
4
+
5
+
6
+ class WeiboAPI:
7
+ def __init__(self, token):
8
+ self.token = token
9
+
10
+ def search_all_v2(self, q: str, start_day: str, start_hour: int, end_day: str, end_hour: int, page: int):
11
+ url = f"{config.BASE_URL}/api/weibo/search-all/v2"
12
+ params = {
13
+ "token": self.token,
14
+ "q": q,
15
+ "startDay": start_day,
16
+ "startHour": start_hour,
17
+ "endDay": end_day,
18
+ "endHour": end_hour,
19
+ "page": page,
20
+ }
21
+
22
+ has_next_page = False
23
+ result, data, message = request_util.get_request_page(url, params)
24
+ try:
25
+ if data:
26
+ if data.get("has_next_page", False) is True:
27
+ has_next_page = True
28
+ except Exception as e:
29
+ logger.warning(f"Pagination parse error at {url}. Contact us to fix it.")
30
+ return result, data, message, has_next_page
31
+
32
+ def search_all_v3(self, q: str, page: int):
33
+ url = f"{config.BASE_URL}/api/weibo/search-all/v3"
34
+ params = {
35
+ "token": self.token,
36
+ "q": q,
37
+ "page": page,
38
+ }
39
+
40
+ has_next_page = False
41
+ result, data, message = request_util.get_request_page(url, params)
42
+ try:
43
+ if data:
44
+ if data.get("cards"):
45
+ has_next_page = True
46
+ except Exception as e:
47
+ logger.warning(f"Pagination parse error at {url}. Contact us to fix it.")
48
+ return result, data, message, has_next_page
49
+
50
+ def get_weibo_detail_v1(self, id: str):
51
+ url = f"{config.BASE_URL}/api/weibo/get-weibo-detail/v1"
52
+ params = {
53
+ "token": self.token,
54
+ "id": id,
55
+ }
56
+ return request_util.get_request(url, params)
57
+
@@ -0,0 +1,139 @@
1
+ from justoneapi import config
2
+ from justoneapi.apis import request_util
3
+ from justoneapi.log import logger
4
+
5
+
6
+ class XiaohongshuAPI:
7
+ def __init__(self, token):
8
+ self.token = token
9
+
10
+ def get_user_v3(self, user_id: str):
11
+ url = f"{config.BASE_URL}/api/xiaohongshu/get-user/v3"
12
+ params = {
13
+ "token": self.token,
14
+ "userId": user_id,
15
+ }
16
+ return request_util.get_request(url, params)
17
+
18
+ def get_user_note_list_v4(self, user_id: str, last_cursor: str = None):
19
+ url = f"{config.BASE_URL}/api/xiaohongshu/get-user-note-list/v4"
20
+ params = {
21
+ "token": self.token,
22
+ "userId": user_id,
23
+ }
24
+ if last_cursor:
25
+ params["lastCursor"] = last_cursor
26
+
27
+ has_next_page = False
28
+ result, data, message = request_util.get_request_page(url, params)
29
+ try:
30
+ if data:
31
+ has_more = data.get("has_more")
32
+ if has_more is not None and isinstance(has_more, bool) and has_more is True:
33
+ has_next_page = True
34
+ except Exception as e:
35
+ logger.warning(f"Pagination parse error at {url}. Contact us to fix it.")
36
+ return result, data, message, has_next_page
37
+
38
+ def get_note_detail_v7(self, note_id: str):
39
+ url = f"{config.BASE_URL}/api/xiaohongshu/get-note-detail/v7"
40
+ params = {
41
+ "token": self.token,
42
+ "noteId": note_id,
43
+ }
44
+ return request_util.get_request(url, params)
45
+
46
+ def get_note_comment_v2(self, note_id: str, last_cursor: str = None):
47
+ url = f"{config.BASE_URL}/api/xiaohongshu/get-note-comment/v2"
48
+ params = {
49
+ "token": self.token,
50
+ "noteId": note_id,
51
+ }
52
+ if last_cursor:
53
+ params["lastCursor"] = last_cursor
54
+
55
+ has_next_page = False
56
+ result, data, message = request_util.get_request_page(url, params)
57
+ try:
58
+ if data:
59
+ has_more = data.get("has_more")
60
+ if has_more is not None and isinstance(has_more, bool) and has_more is True:
61
+ has_next_page = True
62
+ except Exception as e:
63
+ logger.warning(f"Pagination parse error at {url}. Contact us to fix it.")
64
+ return result, data, message, has_next_page
65
+
66
+ def get_note_sub_comment_v2(self, note_id: str, comment_id: str, last_cursor: str = None):
67
+ url = f"{config.BASE_URL}/api/xiaohongshu/get-note-sub-comment/v2"
68
+ params = {
69
+ "token": self.token,
70
+ "noteId": note_id,
71
+ "commentId": comment_id,
72
+ }
73
+ if last_cursor:
74
+ params["lastCursor"] = last_cursor
75
+
76
+ has_next_page = False
77
+ result, data, message = request_util.get_request_page(url, params)
78
+ try:
79
+ if data:
80
+ has_more = data.get("has_more")
81
+ if has_more is not None and isinstance(has_more, bool) and has_more is True:
82
+ has_next_page = True
83
+ except Exception as e:
84
+ logger.warning(f"Pagination parse error at {url}. Contact us to fix it.")
85
+ return result, data, message, has_next_page
86
+
87
+ def search_note_v2(self, keyword: str, page: int, sort: str, note_type: str, note_time: str = None):
88
+ url = f"{config.BASE_URL}/api/xiaohongshu/search-note/v2"
89
+ params = {
90
+ "token": self.token,
91
+ "keyword": keyword,
92
+ "page": page,
93
+ "sort": sort,
94
+ "noteType": note_type,
95
+ }
96
+ if note_time:
97
+ params["noteTime"] = note_time
98
+
99
+ has_next_page = False
100
+ result, data, message = request_util.get_request_page(url, params)
101
+ try:
102
+ if data:
103
+ if data.get("items"):
104
+ has_more = data.get("has_more")
105
+ if has_more is None or (isinstance(has_more, bool) and has_more is True):
106
+ has_next_page = True
107
+ except Exception as e:
108
+ logger.warning(f"Pagination parse error at {url}. Contact us to fix it.")
109
+ return result, data, message, has_next_page
110
+
111
+ def search_user_v2(self, keyword: str, page: int):
112
+ url = f"{config.BASE_URL}/api/xiaohongshu/search-user/v2"
113
+ params = {
114
+ "token": self.token,
115
+ "keyword": keyword,
116
+ "page": page,
117
+ }
118
+
119
+ has_next_page = False
120
+ result, data, message = request_util.get_request_page(url, params)
121
+ try:
122
+ if data:
123
+ if data.get("users"):
124
+ has_more = data.get("has_more")
125
+ if has_more is None or (isinstance(has_more, bool) and has_more is True):
126
+ has_next_page = True
127
+ except Exception as e:
128
+ logger.warning(f"Pagination parse error at {url}. Contact us to fix it.")
129
+ return result, data, message, has_next_page
130
+
131
+ def get_note_feed_v1(self, oid: str, page: int):
132
+ url = f"{config.BASE_URL}/api/xiaohongshu/get-note-feed/v1"
133
+ params = {
134
+ "token": self.token,
135
+ "oid": oid,
136
+ "page": page,
137
+ }
138
+ return request_util.get_request(url, params)
139
+
justoneapi/client.py ADDED
@@ -0,0 +1,21 @@
1
+ from justoneapi.apis.bilibili import BilibiliAPI
2
+ from justoneapi.apis.douyin import DouyinAPI
3
+ from justoneapi.apis.kuaishou import KuaishouAPI
4
+ from justoneapi.apis.taobao import TaobaoAPI
5
+ from justoneapi.apis.user import UserAPI
6
+ from justoneapi.apis.weibo import WeiboAPI
7
+ from justoneapi.apis.xiaohongshu import XiaohongshuAPI
8
+
9
+
10
+ class JustOneAPIClient:
11
+ def __init__(self, token: str):
12
+ if not token:
13
+ raise ValueError("Token is required. Please contact us to obtain one.")
14
+ self.token = token
15
+ self.user = UserAPI(self.token)
16
+ self.taobao = TaobaoAPI(self.token)
17
+ self.xiaohongshu = XiaohongshuAPI(self.token)
18
+ self.douyin = DouyinAPI(self.token)
19
+ self.kuaishou = KuaishouAPI(self.token)
20
+ self.weibo = WeiboAPI(self.token)
21
+ self.bilibili = BilibiliAPI(self.token)
justoneapi/config.py ADDED
@@ -0,0 +1 @@
1
+ BASE_URL = "http://47.117.133.51:30015"
justoneapi/log.py ADDED
@@ -0,0 +1,13 @@
1
+ import logging
2
+
3
+ logger = logging.getLogger("justoneapi")
4
+
5
+ # 如果用户未配置过 handler,则添加默认控制台输出
6
+ if not logger.hasHandlers():
7
+ handler = logging.StreamHandler()
8
+ formatter = logging.Formatter(
9
+ '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
10
+ )
11
+ handler.setFormatter(formatter)
12
+ logger.addHandler(handler)
13
+ logger.setLevel(logging.INFO)
@@ -0,0 +1,102 @@
1
+ Metadata-Version: 2.4
2
+ Name: justoneapi
3
+ Version: 1.0.0
4
+ Summary: Official Python SDK for Just One API
5
+ Author-email: Just One API <justoneapi@gmail.com>
6
+ Description-Content-Type: text/markdown
7
+ License-File: LICENSE
8
+ Requires-Dist: requests
9
+ Dynamic: license-file
10
+
11
+ # Just One API - Python SDK
12
+
13
+ Official Python SDK for accessing [Just One API](https://justoneapi.com) — a unified data service platform offering structured data from Social, E-commerce platforms such as Xiaohongshu, Taobao, Douyin, Kuaishou, Bilibili, and Weibo.
14
+
15
+ This SDK simplifies API integration and request signing, allowing developers to easily retrieve platform-specific data with minimal setup.
16
+
17
+ ---
18
+
19
+ ## 🚀 Installation
20
+
21
+ Install via PyPI:
22
+
23
+ ```bash
24
+ pip install justoneapi
25
+ ```
26
+
27
+ ---
28
+
29
+ ## 🛠 Quick Start
30
+
31
+ ```python
32
+ from justoneapi.client import JustOneAPIClient
33
+
34
+ client = JustOneAPIClient(token="your_token")
35
+
36
+ # Example: Get Douyin Video detail
37
+ result, data, message = client.douyin.get_video_detail_v2(video_id="7428906452091145483")
38
+ print(result)
39
+ print(data)
40
+ print(message)
41
+
42
+ # Example: Douyin Video Search
43
+ result, data, message, has_next_page = client.douyin.search_video_v4(keyword="deepseek", sort_type="_0", publish_time="_0", duration="_0", page=1)
44
+ print(result)
45
+ print(data)
46
+ print(message)
47
+ print(has_next_page)
48
+ ```
49
+
50
+ ### 📦 Return Value Description
51
+
52
+ Each API method returns one or more of the following values:
53
+
54
+ | Variable | Type | Description |
55
+ |------------------|----------|-------------|
56
+ | `result` | `bool` | Whether the request was successful. `True` means success, `False` means failure. |
57
+ | `data` | `dict` / `list` | The actual data returned from the API. Structure varies by endpoint. |
58
+ | `message` | `str` | Message from the server. Contains error info when request fails. |
59
+ | `has_next_page` | `bool` | Present in paginated APIs. Indicates whether more data is available. |
60
+
61
+ ---
62
+
63
+ ## 🔐 Authentication
64
+
65
+ All API requests require a valid API token.
66
+ You can obtain your token by contact us:
67
+ 👉 [Contact](https://justoneapi.com/contact)
68
+
69
+ ---
70
+
71
+ ## 📚 Documentation
72
+
73
+ 👉 Full API docs: [https://justoneapi.com/docs](https://doc.justoneapi.com)
74
+
75
+ Includes:
76
+ - Request parameters
77
+ - Response fields
78
+ - Error codes
79
+
80
+ ---
81
+
82
+ ## 🏠 Official Website
83
+
84
+ 👉 [https://justoneapi.com](https://justoneapi.com)
85
+
86
+ Learn more about the project, data sources, and commercial integration opportunities.
87
+
88
+ ---
89
+
90
+ ## 📬 Contact Us
91
+
92
+ If you have any questions, feedback, or partnership inquiries:
93
+
94
+ - Email: **justoneapi@gmail.com**
95
+ - Telegram: [@justoneapi](https://t.me/justoneapi)
96
+
97
+ ---
98
+
99
+ ## 🪪 License
100
+
101
+ This project is licensed under the MIT License.
102
+ See the [LICENSE](./LICENSE) file for details.
@@ -0,0 +1,18 @@
1
+ justoneapi/__init__.py,sha256=uyfGiipFnhOCQlqywx7wsgp6d-SYnqPqsPQd_xePZl8,23
2
+ justoneapi/client.py,sha256=bHQBLrNJyo8bVqCD_cAJ0HxuNpNy6Vl-eEsYuwaHxNQ,842
3
+ justoneapi/config.py,sha256=YWxWthGg4Xh7IjM1vkqlbBMvSQhW-0lF_wSf3paD9Qk,39
4
+ justoneapi/log.py,sha256=u7gB90CVitO47cA97lYaQJZEqjKzIZEPUuWPOpRFls4,397
5
+ justoneapi/apis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ justoneapi/apis/bilibili.py,sha256=6W2Opbb65mPpBCOLZc1PGKa-ebVCHnj7UzSDDMOyyn4,2807
7
+ justoneapi/apis/douyin.py,sha256=bu_ecjPdYVEuRemrI7Cnk_r0Rbgp5voCNU9zWeKRTKk,4344
8
+ justoneapi/apis/kuaishou.py,sha256=H_KZi8NP2zdS8vU0bxYGqDwDbf7-pjkc37AU2pJx7l8,2656
9
+ justoneapi/apis/request_util.py,sha256=kOUkreLihiLFZV_BI96I7lWFFboYAHtBi16NWsxEc94,1908
10
+ justoneapi/apis/taobao.py,sha256=wwqUwcNTMSff4_GqJv9IWpJb6pOCLo1dhweLmVYrHow,5528
11
+ justoneapi/apis/user.py,sha256=HQAmOTmZ34i4r_IxU62ILCxdPc2Iichud4xmWbEP-gw,645
12
+ justoneapi/apis/weibo.py,sha256=JUGVUIHOwJjjl2QHwQRegmzOEA7MAH7WZZYiX9rlmh8,1858
13
+ justoneapi/apis/xiaohongshu.py,sha256=R8tJsmmjWIXB9MeD8PlkEVDXcbh4hp5K0aIsteva_Ek,5196
14
+ justoneapi-1.0.0.dist-info/licenses/LICENSE,sha256=pAZXnNE2dxxwXFIduGyn1gpvPefJtUYOYZOi3yeGG94,1068
15
+ justoneapi-1.0.0.dist-info/METADATA,sha256=ADg14HYJU4HOaIzPdPy5tthUZVYehflbl1KvU1xnYvE,2711
16
+ justoneapi-1.0.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
17
+ justoneapi-1.0.0.dist-info/top_level.txt,sha256=9doBh84p8kJHxld542lD2zGnraRN92aWN3f6jEDph7Y,11
18
+ justoneapi-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) [year] [fullname]
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ justoneapi