justoneapi 1.0.0__tar.gz → 1.2.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.0.0 → justoneapi-1.2.0}/PKG-INFO +1 -1
- justoneapi-1.2.0/justoneapi/__init__.py +2 -0
- {justoneapi-1.0.0 → justoneapi-1.2.0}/justoneapi/apis/bilibili.py +1 -0
- {justoneapi-1.0.0 → justoneapi-1.2.0}/justoneapi/apis/weibo.py +8 -0
- {justoneapi-1.0.0 → justoneapi-1.2.0}/justoneapi/apis/xiaohongshu.py +71 -0
- {justoneapi-1.0.0 → justoneapi-1.2.0}/justoneapi.egg-info/PKG-INFO +1 -1
- {justoneapi-1.0.0 → justoneapi-1.2.0}/pyproject.toml +1 -1
- {justoneapi-1.0.0 → justoneapi-1.2.0}/tests/test_weibo.py +5 -0
- justoneapi-1.0.0/justoneapi/__init__.py +0 -2
- {justoneapi-1.0.0 → justoneapi-1.2.0}/LICENSE +0 -0
- {justoneapi-1.0.0 → justoneapi-1.2.0}/README.md +0 -0
- {justoneapi-1.0.0 → justoneapi-1.2.0}/justoneapi/apis/__init__.py +0 -0
- {justoneapi-1.0.0 → justoneapi-1.2.0}/justoneapi/apis/douyin.py +0 -0
- {justoneapi-1.0.0 → justoneapi-1.2.0}/justoneapi/apis/kuaishou.py +0 -0
- {justoneapi-1.0.0 → justoneapi-1.2.0}/justoneapi/apis/request_util.py +0 -0
- {justoneapi-1.0.0 → justoneapi-1.2.0}/justoneapi/apis/taobao.py +0 -0
- {justoneapi-1.0.0 → justoneapi-1.2.0}/justoneapi/apis/user.py +0 -0
- {justoneapi-1.0.0 → justoneapi-1.2.0}/justoneapi/client.py +0 -0
- {justoneapi-1.0.0 → justoneapi-1.2.0}/justoneapi/config.py +0 -0
- {justoneapi-1.0.0 → justoneapi-1.2.0}/justoneapi/log.py +0 -0
- {justoneapi-1.0.0 → justoneapi-1.2.0}/justoneapi.egg-info/SOURCES.txt +0 -0
- {justoneapi-1.0.0 → justoneapi-1.2.0}/justoneapi.egg-info/dependency_links.txt +0 -0
- {justoneapi-1.0.0 → justoneapi-1.2.0}/justoneapi.egg-info/requires.txt +0 -0
- {justoneapi-1.0.0 → justoneapi-1.2.0}/justoneapi.egg-info/top_level.txt +0 -0
- {justoneapi-1.0.0 → justoneapi-1.2.0}/setup.cfg +0 -0
- {justoneapi-1.0.0 → justoneapi-1.2.0}/tests/test_bilibili.py +0 -0
- {justoneapi-1.0.0 → justoneapi-1.2.0}/tests/test_douyin.py +0 -0
- {justoneapi-1.0.0 → justoneapi-1.2.0}/tests/test_kuaishou.py +0 -0
- {justoneapi-1.0.0 → justoneapi-1.2.0}/tests/test_taobao.py +0 -0
- {justoneapi-1.0.0 → justoneapi-1.2.0}/tests/test_user.py +0 -0
- {justoneapi-1.0.0 → justoneapi-1.2.0}/tests/test_xiaohongshu.py +0 -0
|
@@ -15,6 +15,7 @@ class BilibiliAPI:
|
|
|
15
15
|
}
|
|
16
16
|
return request_util.get_request(url, params)
|
|
17
17
|
|
|
18
|
+
# todo next main version, change 'aid' to 'param'
|
|
18
19
|
def get_user_video_list_v2(self, uid: str, aid: str = None):
|
|
19
20
|
url = f"{config.BASE_URL}/api/bilibili/get-user-video-list/v2"
|
|
20
21
|
params = {
|
|
@@ -55,3 +55,11 @@ class WeiboAPI:
|
|
|
55
55
|
}
|
|
56
56
|
return request_util.get_request(url, params)
|
|
57
57
|
|
|
58
|
+
def get_user_detail_v1(self, uid: str):
|
|
59
|
+
url = f"{config.BASE_URL}/api/weibo/get-user-detail/v1"
|
|
60
|
+
params = {
|
|
61
|
+
"token": self.token,
|
|
62
|
+
"uid": uid,
|
|
63
|
+
}
|
|
64
|
+
return request_util.get_request(url, params)
|
|
65
|
+
|
|
@@ -43,6 +43,14 @@ class XiaohongshuAPI:
|
|
|
43
43
|
}
|
|
44
44
|
return request_util.get_request(url, params)
|
|
45
45
|
|
|
46
|
+
def get_note_detail_v8(self, note_id: str):
|
|
47
|
+
url = f"{config.BASE_URL}/api/xiaohongshu/get-note-detail/v8"
|
|
48
|
+
params = {
|
|
49
|
+
"token": self.token,
|
|
50
|
+
"noteId": note_id,
|
|
51
|
+
}
|
|
52
|
+
return request_util.get_request(url, params)
|
|
53
|
+
|
|
46
54
|
def get_note_comment_v2(self, note_id: str, last_cursor: str = None):
|
|
47
55
|
url = f"{config.BASE_URL}/api/xiaohongshu/get-note-comment/v2"
|
|
48
56
|
params = {
|
|
@@ -63,6 +71,26 @@ class XiaohongshuAPI:
|
|
|
63
71
|
logger.warning(f"Pagination parse error at {url}. Contact us to fix it.")
|
|
64
72
|
return result, data, message, has_next_page
|
|
65
73
|
|
|
74
|
+
def get_note_comment_v3(self, note_id: str, last_cursor: str = None):
|
|
75
|
+
url = f"{config.BASE_URL}/api/xiaohongshu/get-note-comment/v3"
|
|
76
|
+
params = {
|
|
77
|
+
"token": self.token,
|
|
78
|
+
"noteId": note_id,
|
|
79
|
+
}
|
|
80
|
+
if last_cursor:
|
|
81
|
+
params["lastCursor"] = last_cursor
|
|
82
|
+
|
|
83
|
+
has_next_page = False
|
|
84
|
+
result, data, message = request_util.get_request_page(url, params)
|
|
85
|
+
try:
|
|
86
|
+
if data:
|
|
87
|
+
has_more = data.get("has_more")
|
|
88
|
+
if has_more is not None and isinstance(has_more, bool) and has_more is True:
|
|
89
|
+
has_next_page = True
|
|
90
|
+
except Exception as e:
|
|
91
|
+
logger.warning(f"Pagination parse error at {url}. Contact us to fix it.")
|
|
92
|
+
return result, data, message, has_next_page
|
|
93
|
+
|
|
66
94
|
def get_note_sub_comment_v2(self, note_id: str, comment_id: str, last_cursor: str = None):
|
|
67
95
|
url = f"{config.BASE_URL}/api/xiaohongshu/get-note-sub-comment/v2"
|
|
68
96
|
params = {
|
|
@@ -84,6 +112,27 @@ class XiaohongshuAPI:
|
|
|
84
112
|
logger.warning(f"Pagination parse error at {url}. Contact us to fix it.")
|
|
85
113
|
return result, data, message, has_next_page
|
|
86
114
|
|
|
115
|
+
def get_note_sub_comment_v3(self, note_id: str, comment_id: str, last_cursor: str = None):
|
|
116
|
+
url = f"{config.BASE_URL}/api/xiaohongshu/get-note-sub-comment/v3"
|
|
117
|
+
params = {
|
|
118
|
+
"token": self.token,
|
|
119
|
+
"noteId": note_id,
|
|
120
|
+
"commentId": comment_id,
|
|
121
|
+
}
|
|
122
|
+
if last_cursor:
|
|
123
|
+
params["lastCursor"] = last_cursor
|
|
124
|
+
|
|
125
|
+
has_next_page = False
|
|
126
|
+
result, data, message = request_util.get_request_page(url, params)
|
|
127
|
+
try:
|
|
128
|
+
if data:
|
|
129
|
+
has_more = data.get("has_more")
|
|
130
|
+
if has_more is not None and isinstance(has_more, bool) and has_more is True:
|
|
131
|
+
has_next_page = True
|
|
132
|
+
except Exception as e:
|
|
133
|
+
logger.warning(f"Pagination parse error at {url}. Contact us to fix it.")
|
|
134
|
+
return result, data, message, has_next_page
|
|
135
|
+
|
|
87
136
|
def search_note_v2(self, keyword: str, page: int, sort: str, note_type: str, note_time: str = None):
|
|
88
137
|
url = f"{config.BASE_URL}/api/xiaohongshu/search-note/v2"
|
|
89
138
|
params = {
|
|
@@ -108,6 +157,28 @@ class XiaohongshuAPI:
|
|
|
108
157
|
logger.warning(f"Pagination parse error at {url}. Contact us to fix it.")
|
|
109
158
|
return result, data, message, has_next_page
|
|
110
159
|
|
|
160
|
+
def search_note_v3(self, keyword: str, page: int, sort: str, note_type: str):
|
|
161
|
+
url = f"{config.BASE_URL}/api/xiaohongshu/search-note/v3"
|
|
162
|
+
params = {
|
|
163
|
+
"token": self.token,
|
|
164
|
+
"keyword": keyword,
|
|
165
|
+
"page": page,
|
|
166
|
+
"sort": sort,
|
|
167
|
+
"noteType": note_type,
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
has_next_page = False
|
|
171
|
+
result, data, message = request_util.get_request_page(url, params)
|
|
172
|
+
try:
|
|
173
|
+
if data:
|
|
174
|
+
if data.get("items"):
|
|
175
|
+
has_more = data.get("has_more")
|
|
176
|
+
if has_more is None or (isinstance(has_more, bool) and has_more is True):
|
|
177
|
+
has_next_page = True
|
|
178
|
+
except Exception as e:
|
|
179
|
+
logger.warning(f"Pagination parse error at {url}. Contact us to fix it.")
|
|
180
|
+
return result, data, message, has_next_page
|
|
181
|
+
|
|
111
182
|
def search_user_v2(self, keyword: str, page: int):
|
|
112
183
|
url = f"{config.BASE_URL}/api/xiaohongshu/search-user/v2"
|
|
113
184
|
params = {
|
|
@@ -24,3 +24,8 @@ class TestWeiboAPI(TestCase):
|
|
|
24
24
|
result, data, message = self.client.weibo.get_weibo_detail_v1(id="5062665714010525")
|
|
25
25
|
if result:
|
|
26
26
|
print(json.dumps(data, ensure_ascii=False))
|
|
27
|
+
|
|
28
|
+
def test_get_user_detail_v1(self):
|
|
29
|
+
result, data, message = self.client.weibo.get_user_detail_v1(uid="2387903701")
|
|
30
|
+
if result:
|
|
31
|
+
print(json.dumps(data, ensure_ascii=False))
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|