justoneapi 1.2.1__tar.gz → 1.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.
- {justoneapi-1.2.1 → justoneapi-1.3.0}/PKG-INFO +5 -1
- {justoneapi-1.2.1 → justoneapi-1.3.0}/README.md +4 -0
- justoneapi-1.3.0/justoneapi/__init__.py +2 -0
- {justoneapi-1.2.1 → justoneapi-1.3.0}/justoneapi/apis/bilibili.py +7 -7
- {justoneapi-1.2.1 → justoneapi-1.3.0}/justoneapi/apis/douyin.py +9 -9
- {justoneapi-1.2.1 → justoneapi-1.3.0}/justoneapi/apis/kuaishou.py +7 -7
- {justoneapi-1.2.1 → justoneapi-1.3.0}/justoneapi/apis/taobao.py +13 -13
- {justoneapi-1.2.1 → justoneapi-1.3.0}/justoneapi/apis/user.py +4 -4
- {justoneapi-1.2.1 → justoneapi-1.3.0}/justoneapi/apis/weibo.py +6 -6
- {justoneapi-1.2.1 → justoneapi-1.3.0}/justoneapi/apis/xiaohongshu.py +14 -14
- justoneapi-1.3.0/justoneapi/client.py +28 -0
- justoneapi-1.3.0/justoneapi/config.py +2 -0
- {justoneapi-1.2.1 → justoneapi-1.3.0}/justoneapi.egg-info/PKG-INFO +5 -1
- {justoneapi-1.2.1 → justoneapi-1.3.0}/pyproject.toml +1 -1
- {justoneapi-1.2.1 → justoneapi-1.3.0}/tests/test_douyin.py +1 -1
- justoneapi-1.2.1/justoneapi/__init__.py +0 -2
- justoneapi-1.2.1/justoneapi/client.py +0 -21
- justoneapi-1.2.1/justoneapi/config.py +0 -1
- {justoneapi-1.2.1 → justoneapi-1.3.0}/LICENSE +0 -0
- {justoneapi-1.2.1 → justoneapi-1.3.0}/justoneapi/apis/__init__.py +0 -0
- {justoneapi-1.2.1 → justoneapi-1.3.0}/justoneapi/apis/request_util.py +0 -0
- {justoneapi-1.2.1 → justoneapi-1.3.0}/justoneapi/log.py +0 -0
- {justoneapi-1.2.1 → justoneapi-1.3.0}/justoneapi.egg-info/SOURCES.txt +0 -0
- {justoneapi-1.2.1 → justoneapi-1.3.0}/justoneapi.egg-info/dependency_links.txt +0 -0
- {justoneapi-1.2.1 → justoneapi-1.3.0}/justoneapi.egg-info/requires.txt +0 -0
- {justoneapi-1.2.1 → justoneapi-1.3.0}/justoneapi.egg-info/top_level.txt +0 -0
- {justoneapi-1.2.1 → justoneapi-1.3.0}/setup.cfg +0 -0
- {justoneapi-1.2.1 → justoneapi-1.3.0}/tests/test_bilibili.py +0 -0
- {justoneapi-1.2.1 → justoneapi-1.3.0}/tests/test_kuaishou.py +0 -0
- {justoneapi-1.2.1 → justoneapi-1.3.0}/tests/test_taobao.py +0 -0
- {justoneapi-1.2.1 → justoneapi-1.3.0}/tests/test_user.py +0 -0
- {justoneapi-1.2.1 → justoneapi-1.3.0}/tests/test_weibo.py +0 -0
- {justoneapi-1.2.1 → justoneapi-1.3.0}/tests/test_xiaohongshu.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: justoneapi
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: Official Python SDK for Just One API
|
|
5
5
|
Author-email: Just One API <justoneapi@gmail.com>
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -31,7 +31,11 @@ pip install justoneapi
|
|
|
31
31
|
```python
|
|
32
32
|
from justoneapi.client import JustOneAPIClient
|
|
33
33
|
|
|
34
|
+
# By default, the client uses the "cn" (Mainland China) environment.
|
|
34
35
|
client = JustOneAPIClient(token="your_token")
|
|
36
|
+
# If you are located outside Mainland China and experience slow responses,
|
|
37
|
+
# you can switch to the "global" environment for better performance:
|
|
38
|
+
# client = JustOneAPIClient(token="your_token", env="global")
|
|
35
39
|
|
|
36
40
|
# Example: Get Douyin Video detail
|
|
37
41
|
result, data, message = client.douyin.get_video_detail_v2(video_id="7428906452091145483")
|
|
@@ -21,7 +21,11 @@ pip install justoneapi
|
|
|
21
21
|
```python
|
|
22
22
|
from justoneapi.client import JustOneAPIClient
|
|
23
23
|
|
|
24
|
+
# By default, the client uses the "cn" (Mainland China) environment.
|
|
24
25
|
client = JustOneAPIClient(token="your_token")
|
|
26
|
+
# If you are located outside Mainland China and experience slow responses,
|
|
27
|
+
# you can switch to the "global" environment for better performance:
|
|
28
|
+
# client = JustOneAPIClient(token="your_token", env="global")
|
|
25
29
|
|
|
26
30
|
# Example: Get Douyin Video detail
|
|
27
31
|
result, data, message = client.douyin.get_video_detail_v2(video_id="7428906452091145483")
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
from justoneapi import config
|
|
2
1
|
from justoneapi.apis import request_util
|
|
3
2
|
from justoneapi.log import logger
|
|
4
3
|
|
|
5
4
|
|
|
6
5
|
class BilibiliAPI:
|
|
7
|
-
def __init__(self, token):
|
|
6
|
+
def __init__(self, token: str, base_url: str):
|
|
8
7
|
self.token = token
|
|
8
|
+
self.base_url = base_url
|
|
9
9
|
|
|
10
10
|
def get_video_detail_v2(self, bvid: str):
|
|
11
|
-
url = f"{
|
|
11
|
+
url = f"{self.base_url}/api/bilibili/get-video-detail/v2"
|
|
12
12
|
params = {
|
|
13
13
|
"token": self.token,
|
|
14
14
|
"bvid": bvid,
|
|
@@ -17,7 +17,7 @@ class BilibiliAPI:
|
|
|
17
17
|
|
|
18
18
|
# todo next main version, change 'aid' to 'param'
|
|
19
19
|
def get_user_video_list_v2(self, uid: str, aid: str = None):
|
|
20
|
-
url = f"{
|
|
20
|
+
url = f"{self.base_url}/api/bilibili/get-user-video-list/v2"
|
|
21
21
|
params = {
|
|
22
22
|
"token": self.token,
|
|
23
23
|
"uid": uid,
|
|
@@ -36,7 +36,7 @@ class BilibiliAPI:
|
|
|
36
36
|
return result, data, message, has_next_page
|
|
37
37
|
|
|
38
38
|
def get_user_detail_v2(self, uid: str):
|
|
39
|
-
url = f"{
|
|
39
|
+
url = f"{self.base_url}/api/bilibili/get-user-detail/v2"
|
|
40
40
|
params = {
|
|
41
41
|
"token": self.token,
|
|
42
42
|
"uid": uid,
|
|
@@ -44,7 +44,7 @@ class BilibiliAPI:
|
|
|
44
44
|
return request_util.get_request(url, params)
|
|
45
45
|
|
|
46
46
|
def get_video_comment_v2(self, aid: str, cursor: str = None):
|
|
47
|
-
url = f"{
|
|
47
|
+
url = f"{self.base_url}/api/bilibili/get-video-comment/v2"
|
|
48
48
|
params = {
|
|
49
49
|
"token": self.token,
|
|
50
50
|
"aid": aid,
|
|
@@ -63,7 +63,7 @@ class BilibiliAPI:
|
|
|
63
63
|
return result, data, message, has_next_page
|
|
64
64
|
|
|
65
65
|
def search_video_v2(self, keyword: str, page: int):
|
|
66
|
-
url = f"{
|
|
66
|
+
url = f"{self.base_url}/api/bilibili/search-video/v2"
|
|
67
67
|
params = {
|
|
68
68
|
"token": self.token,
|
|
69
69
|
"keyword": keyword,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
from justoneapi import config
|
|
2
1
|
from justoneapi.apis import request_util
|
|
3
2
|
from justoneapi.log import logger
|
|
4
3
|
|
|
5
4
|
|
|
6
5
|
class DouyinAPI:
|
|
7
|
-
def __init__(self, token):
|
|
6
|
+
def __init__(self, token: str, base_url: str):
|
|
8
7
|
self.token = token
|
|
8
|
+
self.base_url = base_url
|
|
9
9
|
|
|
10
10
|
def get_user_detail_v3(self, sec_uid: str):
|
|
11
|
-
url = f"{
|
|
11
|
+
url = f"{self.base_url}/api/douyin/get-user-detail/v3"
|
|
12
12
|
params = {
|
|
13
13
|
"token": self.token,
|
|
14
14
|
"secUid": sec_uid,
|
|
@@ -16,7 +16,7 @@ class DouyinAPI:
|
|
|
16
16
|
return request_util.get_request(url, params)
|
|
17
17
|
|
|
18
18
|
def get_user_video_list_v3(self, sec_uid: str, max_cursor: int):
|
|
19
|
-
url = f"{
|
|
19
|
+
url = f"{self.base_url}/api/douyin/get-user-video-list/v3"
|
|
20
20
|
params = {
|
|
21
21
|
"token": self.token,
|
|
22
22
|
"secUid": sec_uid,
|
|
@@ -34,7 +34,7 @@ class DouyinAPI:
|
|
|
34
34
|
return result, data, message, has_next_page
|
|
35
35
|
|
|
36
36
|
def get_video_detail_v2(self, video_id: str):
|
|
37
|
-
url = f"{
|
|
37
|
+
url = f"{self.base_url}/api/douyin/get-video-detail/v2"
|
|
38
38
|
params = {
|
|
39
39
|
"token": self.token,
|
|
40
40
|
"videoId": video_id,
|
|
@@ -42,7 +42,7 @@ class DouyinAPI:
|
|
|
42
42
|
return request_util.get_request(url, params)
|
|
43
43
|
|
|
44
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"{
|
|
45
|
+
url = f"{self.base_url}/api/douyin/search-video/v4"
|
|
46
46
|
params = {
|
|
47
47
|
"token": self.token,
|
|
48
48
|
"keyword": keyword,
|
|
@@ -65,7 +65,7 @@ class DouyinAPI:
|
|
|
65
65
|
return result, data, message, has_next_page
|
|
66
66
|
|
|
67
67
|
def search_user_v2(self, keyword: str, page: int, user_type: str = None):
|
|
68
|
-
url = f"{
|
|
68
|
+
url = f"{self.base_url}/api/douyin/search-user/v2"
|
|
69
69
|
params = {
|
|
70
70
|
"token": self.token,
|
|
71
71
|
"keyword": keyword,
|
|
@@ -85,7 +85,7 @@ class DouyinAPI:
|
|
|
85
85
|
return result, data, message, has_next_page
|
|
86
86
|
|
|
87
87
|
def get_video_comment_v1(self, aweme_id: str, page: int):
|
|
88
|
-
url = f"{
|
|
88
|
+
url = f"{self.base_url}/api/douyin/get-video-comment/v1"
|
|
89
89
|
params = {
|
|
90
90
|
"token": self.token,
|
|
91
91
|
"awemeId": aweme_id,
|
|
@@ -103,7 +103,7 @@ class DouyinAPI:
|
|
|
103
103
|
return result, data, message, has_next_page
|
|
104
104
|
|
|
105
105
|
def get_video_sub_comment_v1(self, comment_id: str, page: int):
|
|
106
|
-
url = f"{
|
|
106
|
+
url = f"{self.base_url}/api/douyin/get-video-sub-comment/v1"
|
|
107
107
|
params = {
|
|
108
108
|
"token": self.token,
|
|
109
109
|
"commentId": comment_id,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
from justoneapi import config
|
|
2
1
|
from justoneapi.apis import request_util
|
|
3
2
|
from justoneapi.log import logger
|
|
4
3
|
|
|
5
4
|
|
|
6
5
|
class KuaishouAPI:
|
|
7
|
-
def __init__(self, token):
|
|
6
|
+
def __init__(self, token: str, base_url: str):
|
|
8
7
|
self.token = token
|
|
8
|
+
self.base_url = base_url
|
|
9
9
|
|
|
10
10
|
def search_user_v2(self, keyword: str, page: int):
|
|
11
|
-
url = f"{
|
|
11
|
+
url = f"{self.base_url}/api/kuaishou/search-user/v2"
|
|
12
12
|
params = {
|
|
13
13
|
"token": self.token,
|
|
14
14
|
"keyword": keyword,
|
|
@@ -26,7 +26,7 @@ class KuaishouAPI:
|
|
|
26
26
|
return result, data, message, has_next_page
|
|
27
27
|
|
|
28
28
|
def get_user_video_list_v2(self, user_id: str, pcursor: str = None):
|
|
29
|
-
url = f"{
|
|
29
|
+
url = f"{self.base_url}/api/kuaishou/get-user-video-list/v2"
|
|
30
30
|
params = {
|
|
31
31
|
"token": self.token,
|
|
32
32
|
"userId": user_id,
|
|
@@ -45,7 +45,7 @@ class KuaishouAPI:
|
|
|
45
45
|
return result, data, message, has_next_page
|
|
46
46
|
|
|
47
47
|
def get_video_detail_v2(self, video_id: str):
|
|
48
|
-
url = f"{
|
|
48
|
+
url = f"{self.base_url}/api/kuaishou/get-video-detail/v2"
|
|
49
49
|
params = {
|
|
50
50
|
"token": self.token,
|
|
51
51
|
"videoId": video_id,
|
|
@@ -53,7 +53,7 @@ class KuaishouAPI:
|
|
|
53
53
|
return request_util.get_request(url, params)
|
|
54
54
|
|
|
55
55
|
def search_video_v2(self, keyword: str, page: int):
|
|
56
|
-
url = f"{
|
|
56
|
+
url = f"{self.base_url}/api/kuaishou/search-video/v2"
|
|
57
57
|
params = {
|
|
58
58
|
"token": self.token,
|
|
59
59
|
"keyword": keyword,
|
|
@@ -71,7 +71,7 @@ class KuaishouAPI:
|
|
|
71
71
|
return result, data, message, has_next_page
|
|
72
72
|
|
|
73
73
|
def get_user_detail_v2(self, user_id: str):
|
|
74
|
-
url = f"{
|
|
74
|
+
url = f"{self.base_url}/api/kuaishou/get-user-detail/v1"
|
|
75
75
|
params = {
|
|
76
76
|
"token": self.token,
|
|
77
77
|
"userId": user_id,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
from justoneapi import config
|
|
2
1
|
from justoneapi.apis import request_util
|
|
3
2
|
from justoneapi.log import logger
|
|
4
3
|
|
|
5
4
|
|
|
6
5
|
class TaobaoAPI:
|
|
7
|
-
def __init__(self, token):
|
|
6
|
+
def __init__(self, token: str, base_url: str):
|
|
8
7
|
self.token = token
|
|
8
|
+
self.base_url = base_url
|
|
9
9
|
|
|
10
10
|
def get_item_detail_v1(self, item_id: str):
|
|
11
|
-
url = f"{
|
|
11
|
+
url = f"{self.base_url}/api/taobao/get-item-detail/v1"
|
|
12
12
|
params = {
|
|
13
13
|
"token": self.token,
|
|
14
14
|
"itemId": item_id,
|
|
@@ -16,7 +16,7 @@ class TaobaoAPI:
|
|
|
16
16
|
return request_util.get_request(url, params)
|
|
17
17
|
|
|
18
18
|
def get_item_detail_v2(self, item_id: str):
|
|
19
|
-
url = f"{
|
|
19
|
+
url = f"{self.base_url}/api/taobao/get-item-detail/v2"
|
|
20
20
|
params = {
|
|
21
21
|
"token": self.token,
|
|
22
22
|
"itemId": item_id,
|
|
@@ -24,7 +24,7 @@ class TaobaoAPI:
|
|
|
24
24
|
return request_util.get_request(url, params)
|
|
25
25
|
|
|
26
26
|
def get_item_detail_v3(self, item_id: str):
|
|
27
|
-
url = f"{
|
|
27
|
+
url = f"{self.base_url}/api/taobao/get-item-detail/v3"
|
|
28
28
|
params = {
|
|
29
29
|
"token": self.token,
|
|
30
30
|
"itemId": item_id,
|
|
@@ -32,7 +32,7 @@ class TaobaoAPI:
|
|
|
32
32
|
return request_util.get_request(url, params)
|
|
33
33
|
|
|
34
34
|
def get_item_detail_v4(self, item_id: str):
|
|
35
|
-
url = f"{
|
|
35
|
+
url = f"{self.base_url}/api/taobao/get-item-detail/v4"
|
|
36
36
|
params = {
|
|
37
37
|
"token": self.token,
|
|
38
38
|
"itemId": item_id,
|
|
@@ -40,7 +40,7 @@ class TaobaoAPI:
|
|
|
40
40
|
return request_util.get_request(url, params)
|
|
41
41
|
|
|
42
42
|
def get_item_detail_v5(self, item_id: str):
|
|
43
|
-
url = f"{
|
|
43
|
+
url = f"{self.base_url}/api/taobao/get-item-detail/v5"
|
|
44
44
|
params = {
|
|
45
45
|
"token": self.token,
|
|
46
46
|
"itemId": item_id,
|
|
@@ -48,7 +48,7 @@ class TaobaoAPI:
|
|
|
48
48
|
return request_util.get_request(url, params)
|
|
49
49
|
|
|
50
50
|
def get_item_comment_v6(self, item_id: str, page: int, order_type: str = None):
|
|
51
|
-
url = f"{
|
|
51
|
+
url = f"{self.base_url}/api/taobao/get-item-comment/v6"
|
|
52
52
|
params = {
|
|
53
53
|
"token": self.token,
|
|
54
54
|
"itemId": item_id,
|
|
@@ -68,7 +68,7 @@ class TaobaoAPI:
|
|
|
68
68
|
return result, data, message, has_next_page
|
|
69
69
|
|
|
70
70
|
def get_item_comment_v7(self, item_id: str, page: int, order_type: str = None):
|
|
71
|
-
url = f"{
|
|
71
|
+
url = f"{self.base_url}/api/taobao/get-item-comment/v7"
|
|
72
72
|
params = {
|
|
73
73
|
"token": self.token,
|
|
74
74
|
"itemId": item_id,
|
|
@@ -88,7 +88,7 @@ class TaobaoAPI:
|
|
|
88
88
|
return result, data, message, has_next_page
|
|
89
89
|
|
|
90
90
|
def get_social_feed_v1(self, item_id: str, page: int):
|
|
91
|
-
url = f"{
|
|
91
|
+
url = f"{self.base_url}/api/taobao/get-social-feed/v1"
|
|
92
92
|
params = {
|
|
93
93
|
"token": self.token,
|
|
94
94
|
"itemId": item_id,
|
|
@@ -106,7 +106,7 @@ class TaobaoAPI:
|
|
|
106
106
|
return result, data, message, has_next_page
|
|
107
107
|
|
|
108
108
|
def get_shop_item_list_v9(self, user_id: str, shop_id: str, sort: str, page: int):
|
|
109
|
-
url = f"{
|
|
109
|
+
url = f"{self.base_url}/api/taobao/get-shop-item-list/v9"
|
|
110
110
|
params = {
|
|
111
111
|
"token": self.token,
|
|
112
112
|
"userId": user_id,
|
|
@@ -127,7 +127,7 @@ class TaobaoAPI:
|
|
|
127
127
|
return result, data, message, has_next_page
|
|
128
128
|
|
|
129
129
|
def get_item_sale_v5(self, item_id: str):
|
|
130
|
-
url = f"{
|
|
130
|
+
url = f"{self.base_url}/api/taobao/get-item-sale/v5"
|
|
131
131
|
params = {
|
|
132
132
|
"token": self.token,
|
|
133
133
|
"itemId": item_id,
|
|
@@ -135,7 +135,7 @@ class TaobaoAPI:
|
|
|
135
135
|
return request_util.get_request(url, params)
|
|
136
136
|
|
|
137
137
|
def search_item_list_v6(self, keyword: str, sort: str, page: int, tab: str = None, start_price: str = None, end_price: str = None):
|
|
138
|
-
url = f"{
|
|
138
|
+
url = f"{self.base_url}/api/taobao/search-item-list/v6"
|
|
139
139
|
params = {
|
|
140
140
|
"token": self.token,
|
|
141
141
|
"keyword": keyword,
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
from justoneapi import config
|
|
2
1
|
from justoneapi.apis import request_util
|
|
3
2
|
|
|
4
3
|
|
|
5
4
|
class UserAPI:
|
|
6
|
-
def __init__(self, token):
|
|
5
|
+
def __init__(self, token: str, base_url: str):
|
|
7
6
|
self.token = token
|
|
7
|
+
self.base_url = base_url
|
|
8
8
|
|
|
9
9
|
def get_balance(self):
|
|
10
|
-
url = f"{
|
|
10
|
+
url = f"{self.base_url}/user/get-balance"
|
|
11
11
|
params = {
|
|
12
12
|
"token": self.token,
|
|
13
13
|
}
|
|
14
14
|
return request_util.get_request(url, params)
|
|
15
15
|
|
|
16
16
|
def get_record(self, order_year: int, order_month: int):
|
|
17
|
-
url = f"{
|
|
17
|
+
url = f"{self.base_url}/user/get-record"
|
|
18
18
|
params = {
|
|
19
19
|
"token": self.token,
|
|
20
20
|
"orderYear": order_year,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
from justoneapi import config
|
|
2
1
|
from justoneapi.apis import request_util
|
|
3
2
|
from justoneapi.log import logger
|
|
4
3
|
|
|
5
4
|
|
|
6
5
|
class WeiboAPI:
|
|
7
|
-
def __init__(self, token):
|
|
6
|
+
def __init__(self, token: str, base_url: str):
|
|
8
7
|
self.token = token
|
|
8
|
+
self.base_url = base_url
|
|
9
9
|
|
|
10
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"{
|
|
11
|
+
url = f"{self.base_url}/api/weibo/search-all/v2"
|
|
12
12
|
params = {
|
|
13
13
|
"token": self.token,
|
|
14
14
|
"q": q,
|
|
@@ -30,7 +30,7 @@ class WeiboAPI:
|
|
|
30
30
|
return result, data, message, has_next_page
|
|
31
31
|
|
|
32
32
|
def search_all_v3(self, q: str, page: int):
|
|
33
|
-
url = f"{
|
|
33
|
+
url = f"{self.base_url}/api/weibo/search-all/v3"
|
|
34
34
|
params = {
|
|
35
35
|
"token": self.token,
|
|
36
36
|
"q": q,
|
|
@@ -48,7 +48,7 @@ class WeiboAPI:
|
|
|
48
48
|
return result, data, message, has_next_page
|
|
49
49
|
|
|
50
50
|
def get_weibo_detail_v1(self, id: str):
|
|
51
|
-
url = f"{
|
|
51
|
+
url = f"{self.base_url}/api/weibo/get-weibo-detail/v1"
|
|
52
52
|
params = {
|
|
53
53
|
"token": self.token,
|
|
54
54
|
"id": id,
|
|
@@ -56,7 +56,7 @@ class WeiboAPI:
|
|
|
56
56
|
return request_util.get_request(url, params)
|
|
57
57
|
|
|
58
58
|
def get_user_detail_v1(self, uid: str):
|
|
59
|
-
url = f"{
|
|
59
|
+
url = f"{self.base_url}/api/weibo/get-user-detail/v1"
|
|
60
60
|
params = {
|
|
61
61
|
"token": self.token,
|
|
62
62
|
"uid": uid,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
from justoneapi import config
|
|
2
1
|
from justoneapi.apis import request_util
|
|
3
2
|
from justoneapi.log import logger
|
|
4
3
|
|
|
5
4
|
|
|
6
5
|
class XiaohongshuAPI:
|
|
7
|
-
def __init__(self, token):
|
|
6
|
+
def __init__(self, token: str, base_url: str):
|
|
8
7
|
self.token = token
|
|
8
|
+
self.base_url = base_url
|
|
9
9
|
|
|
10
10
|
def get_user_v3(self, user_id: str):
|
|
11
|
-
url = f"{
|
|
11
|
+
url = f"{self.base_url}/api/xiaohongshu/get-user/v3"
|
|
12
12
|
params = {
|
|
13
13
|
"token": self.token,
|
|
14
14
|
"userId": user_id,
|
|
@@ -16,7 +16,7 @@ class XiaohongshuAPI:
|
|
|
16
16
|
return request_util.get_request(url, params)
|
|
17
17
|
|
|
18
18
|
def get_user_note_list_v4(self, user_id: str, last_cursor: str = None):
|
|
19
|
-
url = f"{
|
|
19
|
+
url = f"{self.base_url}/api/xiaohongshu/get-user-note-list/v4"
|
|
20
20
|
params = {
|
|
21
21
|
"token": self.token,
|
|
22
22
|
"userId": user_id,
|
|
@@ -36,7 +36,7 @@ class XiaohongshuAPI:
|
|
|
36
36
|
return result, data, message, has_next_page
|
|
37
37
|
|
|
38
38
|
def get_note_detail_v7(self, note_id: str):
|
|
39
|
-
url = f"{
|
|
39
|
+
url = f"{self.base_url}/api/xiaohongshu/get-note-detail/v7"
|
|
40
40
|
params = {
|
|
41
41
|
"token": self.token,
|
|
42
42
|
"noteId": note_id,
|
|
@@ -44,7 +44,7 @@ class XiaohongshuAPI:
|
|
|
44
44
|
return request_util.get_request(url, params)
|
|
45
45
|
|
|
46
46
|
def get_note_detail_v8(self, note_id: str):
|
|
47
|
-
url = f"{
|
|
47
|
+
url = f"{self.base_url}/api/xiaohongshu/get-note-detail/v8"
|
|
48
48
|
params = {
|
|
49
49
|
"token": self.token,
|
|
50
50
|
"noteId": note_id,
|
|
@@ -52,7 +52,7 @@ class XiaohongshuAPI:
|
|
|
52
52
|
return request_util.get_request(url, params)
|
|
53
53
|
|
|
54
54
|
def get_note_comment_v2(self, note_id: str, last_cursor: str = None):
|
|
55
|
-
url = f"{
|
|
55
|
+
url = f"{self.base_url}/api/xiaohongshu/get-note-comment/v2"
|
|
56
56
|
params = {
|
|
57
57
|
"token": self.token,
|
|
58
58
|
"noteId": note_id,
|
|
@@ -72,7 +72,7 @@ class XiaohongshuAPI:
|
|
|
72
72
|
return result, data, message, has_next_page
|
|
73
73
|
|
|
74
74
|
def get_note_comment_v3(self, note_id: str, last_cursor: str = None):
|
|
75
|
-
url = f"{
|
|
75
|
+
url = f"{self.base_url}/api/xiaohongshu/get-note-comment/v3"
|
|
76
76
|
params = {
|
|
77
77
|
"token": self.token,
|
|
78
78
|
"noteId": note_id,
|
|
@@ -92,7 +92,7 @@ class XiaohongshuAPI:
|
|
|
92
92
|
return result, data, message, has_next_page
|
|
93
93
|
|
|
94
94
|
def get_note_sub_comment_v2(self, note_id: str, comment_id: str, last_cursor: str = None):
|
|
95
|
-
url = f"{
|
|
95
|
+
url = f"{self.base_url}/api/xiaohongshu/get-note-sub-comment/v2"
|
|
96
96
|
params = {
|
|
97
97
|
"token": self.token,
|
|
98
98
|
"noteId": note_id,
|
|
@@ -113,7 +113,7 @@ class XiaohongshuAPI:
|
|
|
113
113
|
return result, data, message, has_next_page
|
|
114
114
|
|
|
115
115
|
def get_note_sub_comment_v3(self, note_id: str, comment_id: str, last_cursor: str = None):
|
|
116
|
-
url = f"{
|
|
116
|
+
url = f"{self.base_url}/api/xiaohongshu/get-note-sub-comment/v3"
|
|
117
117
|
params = {
|
|
118
118
|
"token": self.token,
|
|
119
119
|
"noteId": note_id,
|
|
@@ -134,7 +134,7 @@ class XiaohongshuAPI:
|
|
|
134
134
|
return result, data, message, has_next_page
|
|
135
135
|
|
|
136
136
|
def search_note_v2(self, keyword: str, page: int, sort: str, note_type: str, note_time: str = None):
|
|
137
|
-
url = f"{
|
|
137
|
+
url = f"{self.base_url}/api/xiaohongshu/search-note/v2"
|
|
138
138
|
params = {
|
|
139
139
|
"token": self.token,
|
|
140
140
|
"keyword": keyword,
|
|
@@ -158,7 +158,7 @@ class XiaohongshuAPI:
|
|
|
158
158
|
return result, data, message, has_next_page
|
|
159
159
|
|
|
160
160
|
def search_note_v3(self, keyword: str, page: int, sort: str, note_type: str):
|
|
161
|
-
url = f"{
|
|
161
|
+
url = f"{self.base_url}/api/xiaohongshu/search-note/v3"
|
|
162
162
|
params = {
|
|
163
163
|
"token": self.token,
|
|
164
164
|
"keyword": keyword,
|
|
@@ -180,7 +180,7 @@ class XiaohongshuAPI:
|
|
|
180
180
|
return result, data, message, has_next_page
|
|
181
181
|
|
|
182
182
|
def search_user_v2(self, keyword: str, page: int):
|
|
183
|
-
url = f"{
|
|
183
|
+
url = f"{self.base_url}/api/xiaohongshu/search-user/v2"
|
|
184
184
|
params = {
|
|
185
185
|
"token": self.token,
|
|
186
186
|
"keyword": keyword,
|
|
@@ -200,7 +200,7 @@ class XiaohongshuAPI:
|
|
|
200
200
|
return result, data, message, has_next_page
|
|
201
201
|
|
|
202
202
|
def get_note_feed_v1(self, oid: str, page: int):
|
|
203
|
-
url = f"{
|
|
203
|
+
url = f"{self.base_url}/api/xiaohongshu/get-note-feed/v1"
|
|
204
204
|
params = {
|
|
205
205
|
"token": self.token,
|
|
206
206
|
"oid": oid,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
from justoneapi import config
|
|
2
|
+
from justoneapi.apis.bilibili import BilibiliAPI
|
|
3
|
+
from justoneapi.apis.douyin import DouyinAPI
|
|
4
|
+
from justoneapi.apis.kuaishou import KuaishouAPI
|
|
5
|
+
from justoneapi.apis.taobao import TaobaoAPI
|
|
6
|
+
from justoneapi.apis.user import UserAPI
|
|
7
|
+
from justoneapi.apis.weibo import WeiboAPI
|
|
8
|
+
from justoneapi.apis.xiaohongshu import XiaohongshuAPI
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class JustOneAPIClient:
|
|
12
|
+
def __init__(self, token: str, env: str = "cn"):
|
|
13
|
+
if not token:
|
|
14
|
+
raise ValueError("Token is required. Please contact us to obtain one.")
|
|
15
|
+
self.token = token
|
|
16
|
+
if env == "cn":
|
|
17
|
+
self.base_url = config.BASE_URL_CN
|
|
18
|
+
elif env == "global":
|
|
19
|
+
self.base_url = config.BASE_URL_GLOBAL
|
|
20
|
+
else:
|
|
21
|
+
raise ValueError("env must be 'cn' or 'global'.")
|
|
22
|
+
self.user = UserAPI(self.token, self.base_url)
|
|
23
|
+
self.taobao = TaobaoAPI(self.token, self.base_url)
|
|
24
|
+
self.xiaohongshu = XiaohongshuAPI(self.token, self.base_url)
|
|
25
|
+
self.douyin = DouyinAPI(self.token, self.base_url)
|
|
26
|
+
self.kuaishou = KuaishouAPI(self.token, self.base_url)
|
|
27
|
+
self.weibo = WeiboAPI(self.token, self.base_url)
|
|
28
|
+
self.bilibili = BilibiliAPI(self.token, self.base_url)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: justoneapi
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: Official Python SDK for Just One API
|
|
5
5
|
Author-email: Just One API <justoneapi@gmail.com>
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -31,7 +31,11 @@ pip install justoneapi
|
|
|
31
31
|
```python
|
|
32
32
|
from justoneapi.client import JustOneAPIClient
|
|
33
33
|
|
|
34
|
+
# By default, the client uses the "cn" (Mainland China) environment.
|
|
34
35
|
client = JustOneAPIClient(token="your_token")
|
|
36
|
+
# If you are located outside Mainland China and experience slow responses,
|
|
37
|
+
# you can switch to the "global" environment for better performance:
|
|
38
|
+
# client = JustOneAPIClient(token="your_token", env="global")
|
|
35
39
|
|
|
36
40
|
# Example: Get Douyin Video detail
|
|
37
41
|
result, data, message = client.douyin.get_video_detail_v2(video_id="7428906452091145483")
|
|
@@ -6,7 +6,7 @@ from justoneapi.client import JustOneAPIClient
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class TestDouyinAPI(TestCase):
|
|
9
|
-
client = JustOneAPIClient(token=os.environ.get("JUSTONEAPI_TOKEN"))
|
|
9
|
+
client = JustOneAPIClient(token=os.environ.get("JUSTONEAPI_TOKEN"), env="global")
|
|
10
10
|
|
|
11
11
|
def test_get_user_detail_v3(self):
|
|
12
12
|
result, data, message = self.client.douyin.get_user_detail_v3(
|
|
@@ -1,21 +0,0 @@
|
|
|
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)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
BASE_URL = "http://47.117.133.51:30015"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|