Skip to content

Commit

Permalink
fix: cannot get user info through user_id if not login
Browse files Browse the repository at this point in the history
  • Loading branch information
Starry-OvO committed Jun 6, 2023
1 parent 6657f60 commit 8c17790
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions aiotieba/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,28 +335,21 @@ async def get_user_info(self, _id: Union[str, int], /, require: ReqUInfo = ReqUI
return UserInfo(_id)

if isinstance(_id, int):
if (require | ReqUInfo.BASIC) == ReqUInfo.BASIC:
# 仅有BASIC需求
return await self._get_uinfo_getUserInfo(_id)
elif require & ReqUInfo.TIEBA_UID:
# 有TIEBA_UID需求
user = await self._get_uinfo_getUserInfo(_id)
if require <= ReqUInfo.NICK_NAME:
# 仅有NICK_NAME以下的需求
return await self._get_uinfo_getuserinfo(_id)
else:
user = await self._get_uinfo_getuserinfo(_id)
user, _ = await self.get_homepage(user.portrait, with_threads=False)
return user
else:
# 有除TIEBA_UID外的其他非BASIC需求
return await self._get_uinfo_getuserinfo(_id)
elif is_portrait(_id):
if (require | ReqUInfo.BASIC) == ReqUInfo.BASIC:
# 仅有BASIC需求
if not require & ReqUInfo.USER_ID:
# 无USER_ID需求
return await self._get_uinfo_panel(_id)
else:
user, _ = await self.get_homepage(_id, with_threads=False)
return user
else:
user, _ = await self.get_homepage(_id, with_threads=False)
return user
user, _ = await self.get_homepage(_id, with_threads=False)
return user
else:
if (require | ReqUInfo.BASIC) == ReqUInfo.BASIC:
return await self._get_uinfo_user_json(_id)
Expand Down

0 comments on commit 8c17790

Please sign in to comment.