Skip to content

Commit

Permalink
feat: add user search api
Browse files Browse the repository at this point in the history
  • Loading branch information
ReaJason committed Jan 13, 2024
1 parent 45a7188 commit f9f9872
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions xhs/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f9f9872

Please sign in to comment.