Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[提问]unban_user 如何调用? #571

Closed
TZFC opened this issue Nov 19, 2023 · 16 comments
Closed

[提问]unban_user 如何调用? #571

TZFC opened this issue Nov 19, 2023 · 16 comments
Labels
need debug info 需要 DEBUG 信息 question 这啥呀这是,我不到啊

Comments

@TZFC
Copy link
Contributor

TZFC commented Nov 19, 2023

async def unban_user(self, block_id: int) -> dict:

这里说“封禁用户时会返回该封禁事件的 ID”,然而并没有:

response = await room.ban_user(1454277253)
print(response)

{}

接下来尝试根据 文档里 的说明调用 get_black_list()获取到了封禁事件ID,然而返回 {'code': 65530, 'msg': 'invalid request', 'message': 'invalid request', 'data': 'bad token'}
已经通过

res = await mycredential.check_refresh()
print(res)

False

确认Credential是有效的了
我从网页上手动解禁,看network里的del_room_block_user事件payload, 跟API里明明一样的,搞不明白了
试着用dev分支,依然不行

@TZFC
Copy link
Contributor Author

TZFC commented Nov 19, 2023

@z0z0r4 z0z0r4 added question 这啥呀这是,我不到啊 need debug info 需要 DEBUG 信息 labels Nov 20, 2023
@z0z0r4
Copy link
Collaborator

z0z0r4 commented Nov 20, 2023

需要确认,直播可能改了

@blyc
Copy link

blyc commented Nov 20, 2023

个人测试已无法查到旧接口
新接口为:https://api.live.bilibili.com/xlive/web-ucenter/v1/banned/DelSilentUser

相关修改 仅供参考

live.json line:293

"del_block": {
      "url": "https://api.live.bilibili.com/xlive/web-ucenter/v1/banned/DelSilentUser",
      "method": "POST",
      "verify": true,
      "params": {
        "room_id": "str: 真实房间号",
        "tuid": "str: 封禁 ID,从 ID.info.black_list 中获取或者 ID.operate.black_list 的返回值获取"
      },
      "comment": "解封用户"
    },

live.py line:456

data = {
            "room_id": str(self.room_display_id),
            "tuid": str(block_id),
        }

不改入参类型用str硬转是测试随手写的
不pr是我笨()

@z0z0r4
Copy link
Collaborator

z0z0r4 commented Nov 20, 2023

不pr是要气死我

@z0z0r4
Copy link
Collaborator

z0z0r4 commented Nov 20, 2023

get_black_list 如何? @blyc

@blyc
Copy link

blyc commented Nov 21, 2023

get_black_list 如何? @blyc

调用正常,看了下和网页端用的也是同一个接口
https://api.live.bilibili.com/xlive/web-ucenter/v1/banned/GetSilentUserList
同类的api如加入黑名单也是正常
https://api.live.bilibili.com/xlive/web-ucenter/v1/banned/AddSilentUser

看来就是api升级整合了
banned_servicehttps://api.live.bilibili.com/banned_service/v1/Silent/del_room_block_user
变为web-ucenterhttps://api.live.bilibili.com/xlive/web-ucenter/v1/banned/DelSilentUser

@z0z0r4
Copy link
Collaborator

z0z0r4 commented Nov 25, 2023

我没直播间可测试,那就这样commit了

个人测试已无法查到旧接口 新接口为:api.live.bilibili.com/xlive/web-ucenter/v1/banned/DelSilentUser

相关修改 仅供参考

live.json line:293

"del_block": {
      "url": "https://api.live.bilibili.com/xlive/web-ucenter/v1/banned/DelSilentUser",
      "method": "POST",
      "verify": true,
      "params": {
        "room_id": "str: 真实房间号",
        "tuid": "str: 封禁 ID,从 ID.info.black_list 中获取或者 ID.operate.black_list 的返回值获取"
      },
      "comment": "解封用户"
    },

live.py line:456

data = {
            "room_id": str(self.room_display_id),
            "tuid": str(block_id),
        }

不改入参类型用str硬转是测试随手写的 不pr是我笨()

z0z0r4 added a commit to z0z0r4/bilibili-api that referenced this issue Nov 25, 2023
@z0z0r4
Copy link
Collaborator

z0z0r4 commented Nov 25, 2023

z0z0r4@ddabd77

@z0z0r4 z0z0r4 closed this as completed Nov 25, 2023
@TZFC
Copy link
Contributor Author

TZFC commented Nov 25, 2023

测试了一下还是不行。返回的错误信息也没有帮助:

ResponseCodeException: 接口返回错误代码:65530,信息:invalid request。
{'code': 65530, 'msg': 'invalid request', 'message': 'invalid request', 'data': 'bad token'}

@z0z0r4
Copy link
Collaborator

z0z0r4 commented Nov 25, 2023

将会在 audio-uploader 搞定之后合并,等我 release

或者自己根据 commit 修改源代码

@TZFC
Copy link
Contributor Author

TZFC commented Nov 25, 2023

嗯,我在自己的 fork 上按照 commit 测试了下,有了个新的报错:

ResponseCodeException: 接口返回错误代码:-400,信息:Key: 'DelSilentUserReq.RoomId' Error:Field validation for 'RoomId' failed on the 'required' tag。
{'code': -400, 'message': "Key: 'DelSilentUserReq.RoomId' Error:Field validation for 'RoomId' failed on the 'required' tag", 'ttl': 1}

正在进一步研究中。。。

@TZFC
Copy link
Contributor Author

TZFC commented Nov 25, 2023

搞定了。
tuid 是被封禁用户的 uid,也就是说不再使用 block_id 了。
相对应的注释我也一并改了,一会儿 pr。
测试成功

@z0z0r4
Copy link
Collaborator

z0z0r4 commented Nov 25, 2023

搞定了。 tuid 是被封禁用户的 uid,也就是说不再使用 block_id 了。 相对应的注释我也一并改了,一会儿 pr。 测试成功

emm,那你直接 pr 到 dev 吧,我到时候 conflict

@z0z0r4
Copy link
Collaborator

z0z0r4 commented Nov 25, 2023

话说你这样用 colab 来测试,号不会因为异地登录次数过多没要求验证吗?

@TZFC TZFC mentioned this issue Nov 25, 2023
@TZFC
Copy link
Contributor Author

TZFC commented Nov 25, 2023

话说你这样用 colab 来测试,号不会因为异地登录次数过多没要求验证吗?

目前还没遇到诶。可能我平时就挂 vpn 到处登录,阿 b 表示习惯了?w

@TZFC
Copy link
Contributor Author

TZFC commented Dec 2, 2024

今天开始出现参数错误:

bilibili_api.exceptions.ResponseCodeException.ResponseCodeException: 接口返回错误代码:1,信息:参数错误。
{'code': 1, 'msg': '参数错误', 'message': '参数错误', 'data': []}

从网页上解禁payload如下

tuid: 20052482
room_id: 23596840
mobi_app: web
csrf_token: b686ab3f89be7cf8ba1a1743d38ee9fa
csrf: b686ab3f89be7cf8ba1a1743d38ee9fa
visit_id: d2o13p2t9eo0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need debug info 需要 DEBUG 信息 question 这啥呀这是,我不到啊
Projects
None yet
Development

No branches or pull requests

3 participants