From f9f9872abf0eb1e78f00ac574419f35a2748f06b Mon Sep 17 00:00:00 2001 From: ReaJason Date: Sat, 13 Jan 2024 16:42:15 +0800 Subject: [PATCH] feat: add user search api --- xhs/core.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/xhs/core.py b/xhs/core.py index 24b0824..5dbc7b6 100644 --- a/xhs/core.py +++ b/xhs/core.py @@ -321,6 +321,20 @@ def get_self_info2(self): uri = "/api/sns/web/v2/user/me" return self.get(uri) + def get_user_by_keyword(self, keyword: str, + page: int = 1, + page_size: int = 20, ): + uri = "/api/sns/web/v1/search/usersearch" + data = { + "search_user_request": { + "keyword": keyword, "search_id": get_search_id(), + "page": page, "page_size": page_size, + "biz_type": "web_search_user", + "request_id": f"{int(round(time.time()))}-{int(round(time.time() * 1000))}", + } + } + return self.post(uri, data) + def get_user_info(self, user_id: str): """ :param user_id: user_id you want fetch