【问题标题】:How to look up YouTube Live Chat Ban ID to delete it如何查找 YouTube Live Chat Ban ID 以将其删除
【发布时间】:2019-09-07 08:55:36
【问题描述】:

YouTube Live Streaming API 能够禁止和取消禁止用户聊天,并提供以下方法来专门执行取消禁止:

https://developers.google.com/youtube/v3/live/docs/liveChatBans/delete

API 要求您传递标识要删除的聊天禁令的 id 参数,并声明该值唯一标识了禁令和聊天。但是,似乎没有任何方法可以查找频道的聊天禁令,除非您在禁令发生时最初取回 ID。

那么有没有办法在禁令发生并且您不再拥有禁令 ID 之后很久通过 API 解除对用户的禁令?

【问题讨论】:

    标签: youtube-livestreaming-api


    【解决方案1】:

    其实LiveChatBanId是一个base64编码的字符串,包含

    • 禁止用户频道 ID
    • 所有者频道 ID
    • 一些随机字节?

    这里有一些 python 代码会为你生成它

        import base64
        banned_user_id = 'banned user id'
        owner_channel_id = 'channel owner id'
    
        decoded = f"\x08\x01\x12\x18{banned_user_id}\x1a8\n\r\n\x0b7cHT2DHCA7s*'\n\x18{owner_channel_id}\x12\x0b7cHT2DHCA7s".encode('utf-8')
        encoded = base64.b64encode(decoded)
        print(encoded)
    

    填写banned_user_idowner_channel_id

    您可能需要调用两次“LiveChatBans: delete”方法,这就是 Google 的工作方式

    【讨论】:

      猜你喜欢
      • 2021-06-11
      • 2020-11-21
      • 1970-01-01
      • 1970-01-01
      • 2023-04-03
      • 2020-05-28
      • 1970-01-01
      • 2014-10-17
      • 2012-09-08
      相关资源
      最近更新 更多