diff --git a/.gitignore b/.gitignore index 47b6178..d3c3f58 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,6 @@ __pycache__/ *.egg-info/ dist/ build/ -.venv/ \ No newline at end of file +.venv/ +.idea/ +**/.DS_Store \ No newline at end of file diff --git a/justoneapi/__init__.py b/justoneapi/__init__.py index 457dc1a..d8c9955 100644 --- a/justoneapi/__init__.py +++ b/justoneapi/__init__.py @@ -1,2 +1,2 @@ -__version__ = "1.0.0" +__version__ = "1.2.1" diff --git a/justoneapi/apis/bilibili.py b/justoneapi/apis/bilibili.py index 7a585be..1a67064 100644 --- a/justoneapi/apis/bilibili.py +++ b/justoneapi/apis/bilibili.py @@ -15,6 +15,7 @@ def get_video_detail_v2(self, bvid: str): } return request_util.get_request(url, params) + # todo next main version, change 'aid' to 'param' def get_user_video_list_v2(self, uid: str, aid: str = None): url = f"{config.BASE_URL}/api/bilibili/get-user-video-list/v2" params = { diff --git a/justoneapi/apis/taobao.py b/justoneapi/apis/taobao.py index 703ab5b..77d4f93 100644 --- a/justoneapi/apis/taobao.py +++ b/justoneapi/apis/taobao.py @@ -134,7 +134,7 @@ def get_item_sale_v5(self, item_id: str): } return request_util.get_request(url, params) - def search_item_list_v6(self, keyword: str, sort: str, page: int, tab: str = None): + def search_item_list_v6(self, keyword: str, sort: str, page: int, tab: str = None, start_price: str = None, end_price: str = None): url = f"{config.BASE_URL}/api/taobao/search-item-list/v6" params = { "token": self.token, @@ -144,6 +144,10 @@ def search_item_list_v6(self, keyword: str, sort: str, page: int, tab: str = Non } if tab: params["tab"] = tab + if start_price: + params["startPrice"] = start_price + if end_price: + params["endPrice"] = end_price has_next_page = False result, data, message = request_util.get_request_page(url, params) diff --git a/justoneapi/apis/weibo.py b/justoneapi/apis/weibo.py index 578ec90..1b9dddf 100644 --- a/justoneapi/apis/weibo.py +++ b/justoneapi/apis/weibo.py @@ -55,3 +55,11 @@ def get_weibo_detail_v1(self, id: str): } return request_util.get_request(url, params) + def get_user_detail_v1(self, uid: str): + url = f"{config.BASE_URL}/api/weibo/get-user-detail/v1" + params = { + "token": self.token, + "uid": uid, + } + return request_util.get_request(url, params) + diff --git a/justoneapi/apis/xiaohongshu.py b/justoneapi/apis/xiaohongshu.py index bddab19..a644a3f 100644 --- a/justoneapi/apis/xiaohongshu.py +++ b/justoneapi/apis/xiaohongshu.py @@ -43,6 +43,14 @@ def get_note_detail_v7(self, note_id: str): } return request_util.get_request(url, params) + def get_note_detail_v8(self, note_id: str): + url = f"{config.BASE_URL}/api/xiaohongshu/get-note-detail/v8" + params = { + "token": self.token, + "noteId": note_id, + } + return request_util.get_request(url, params) + def get_note_comment_v2(self, note_id: str, last_cursor: str = None): url = f"{config.BASE_URL}/api/xiaohongshu/get-note-comment/v2" params = { @@ -63,6 +71,26 @@ def get_note_comment_v2(self, note_id: str, last_cursor: str = None): logger.warning(f"Pagination parse error at {url}. Contact us to fix it.") return result, data, message, has_next_page + def get_note_comment_v3(self, note_id: str, last_cursor: str = None): + url = f"{config.BASE_URL}/api/xiaohongshu/get-note-comment/v3" + params = { + "token": self.token, + "noteId": note_id, + } + if last_cursor: + params["lastCursor"] = last_cursor + + has_next_page = False + result, data, message = request_util.get_request_page(url, params) + try: + if data: + has_more = data.get("has_more") + if has_more is not None and isinstance(has_more, bool) and has_more is True: + has_next_page = True + except Exception as e: + logger.warning(f"Pagination parse error at {url}. Contact us to fix it.") + return result, data, message, has_next_page + def get_note_sub_comment_v2(self, note_id: str, comment_id: str, last_cursor: str = None): url = f"{config.BASE_URL}/api/xiaohongshu/get-note-sub-comment/v2" params = { @@ -84,6 +112,27 @@ def get_note_sub_comment_v2(self, note_id: str, comment_id: str, last_cursor: st logger.warning(f"Pagination parse error at {url}. Contact us to fix it.") return result, data, message, has_next_page + def get_note_sub_comment_v3(self, note_id: str, comment_id: str, last_cursor: str = None): + url = f"{config.BASE_URL}/api/xiaohongshu/get-note-sub-comment/v3" + params = { + "token": self.token, + "noteId": note_id, + "commentId": comment_id, + } + if last_cursor: + params["lastCursor"] = last_cursor + + has_next_page = False + result, data, message = request_util.get_request_page(url, params) + try: + if data: + has_more = data.get("has_more") + if has_more is not None and isinstance(has_more, bool) and has_more is True: + has_next_page = True + except Exception as e: + logger.warning(f"Pagination parse error at {url}. Contact us to fix it.") + return result, data, message, has_next_page + def search_note_v2(self, keyword: str, page: int, sort: str, note_type: str, note_time: str = None): url = f"{config.BASE_URL}/api/xiaohongshu/search-note/v2" params = { @@ -108,6 +157,28 @@ def search_note_v2(self, keyword: str, page: int, sort: str, note_type: str, not logger.warning(f"Pagination parse error at {url}. Contact us to fix it.") return result, data, message, has_next_page + def search_note_v3(self, keyword: str, page: int, sort: str, note_type: str): + url = f"{config.BASE_URL}/api/xiaohongshu/search-note/v3" + params = { + "token": self.token, + "keyword": keyword, + "page": page, + "sort": sort, + "noteType": note_type, + } + + has_next_page = False + result, data, message = request_util.get_request_page(url, params) + try: + if data: + if data.get("items"): + has_more = data.get("has_more") + if has_more is None or (isinstance(has_more, bool) and has_more is True): + has_next_page = True + except Exception as e: + logger.warning(f"Pagination parse error at {url}. Contact us to fix it.") + return result, data, message, has_next_page + def search_user_v2(self, keyword: str, page: int): url = f"{config.BASE_URL}/api/xiaohongshu/search-user/v2" params = { diff --git a/pyproject.toml b/pyproject.toml index e557def..7c1ee7c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "justoneapi" -version = "1.0.0" +version = "1.2.1" description = "Official Python SDK for Just One API" authors = [{ name="Just One API", email="justoneapi@gmail.com" }] readme = "README.md" diff --git a/tests/test_weibo.py b/tests/test_weibo.py index 4336948..e914956 100644 --- a/tests/test_weibo.py +++ b/tests/test_weibo.py @@ -24,3 +24,8 @@ def test_get_weibo_detail_v1(self): result, data, message = self.client.weibo.get_weibo_detail_v1(id="5062665714010525") if result: print(json.dumps(data, ensure_ascii=False)) + + def test_get_user_detail_v1(self): + result, data, message = self.client.weibo.get_user_detail_v1(uid="2387903701") + if result: + print(json.dumps(data, ensure_ascii=False))
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: