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

[新增/更新请求] 对于 DANMU_MSG 事件数据的补充 #1084

Open
1 task done
yandujun363 opened this issue Aug 18, 2024 · 5 comments
Open
1 task done

[新增/更新请求] 对于 DANMU_MSG 事件数据的补充 #1084

yandujun363 opened this issue Aug 18, 2024 · 5 comments
Labels
新增/Add 添加或修改新的内容 弹幕/Danmaku 接口:弹幕 直播/Live 接口:直播

Comments

@yandujun363
Copy link

提交前请确认

  • 我已检索仓库中文档,不包含所提及内容,或所提及内容在本仓库中存在错误,且 Issues、Pull Requests 中无相关提交

API 来源

Web 端(含 h5)

API 类型

长连接数据帧(含 ws、TCP)

API 地址

https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/docs/live/message_stream.md#%E5%BC%B9%E5%B9%95

详情描述

对于DANMU_MSG事件数据的补充
个人猜测+抓包+机翻键名,不一定准确

{
    "cmd": "DANMU_MSG",
    "dm_v2": "",
    "info": [
        [
            0,
            1,
            25,//字体大小
            9920249,//弹幕颜色代码(10进制)#975ef9
            1723979200649,
            -1312973962,
            0,
            "0bc8acd0",
            0,
            0,
            0,
            "",
            0,
            "{}",
            "{}",
            {
                "extra": "{\"send_from_me\":false,\"mode\":0,\"color\":9920249,\"dm_type\":0,\"font_size\":25,\"player_mode\":1,\"show_player_type\":0,\"content\":\"白花300块[热]\",\"user_hash\":\"197700816\",\"emoticon_unique\":\"\",\"bulge_display\":0,\"recommend_score\":3,\"main_state_dm_color\":\"\",\"objective_state_dm_color\":\"\",\"direction\":0,\"pk_direction\":0,\"quartet_direction\":0,\"anniversary_crowd\":0,\"yeah_space_type\":\"\",\"yeah_space_url\":\"\",\"jump_to_url\":\"\",\"space_type\":\"\",\"space_url\":\"\",\"animation\":{},\"emots\":{\"[热]\":{\"count\":1,\"descript\":\"[热]\",\"emoji\":\"[热]\",\"emoticon_id\":278,\"emoticon_unique\":\"emoji_278\",\"height\":20,\"url\":\"http://i0.hdslb.com/bfs/live/6df760280b17a6cbac8c1874d357298f982ba4cf.png\",\"width\":20}},\"is_audited\":false,\"id_str\":\"364b06e3c561af3d5921f1253d66c1d575\",\"icon\":{\"prefix\":{\"type\":1,\"resource\":\"ChronosWealth_4.png\"}},\"show_reply\":true,\"reply_mid\":0,\"reply_uname\":\"\",\"reply_uname_color\":\"\",\"reply_is_mystery\":false,\"hit_combo\":0}",
                "mode": 0,
                "show_player_type": 0,
                "user": {
                    "base": {
                        "face": "https://i1.hdslb.com/bfs/face/5a9bb9cac3afbb58347c808ae76aaa41ca967d07.jpg",//弹幕发送用户头像
                        "is_mystery": false,
                        "name": "tim1997",//弹幕发送用户名称
                        "name_color": 0,
                        "name_color_str": "",
                        "official_info": {
                            "desc": "",
                            "role": 0,
                            "title": "",
                            "type": -1
                        },
                        "origin_info": {
                            "face": "https://i1.hdslb.com/bfs/face/5a9bb9cac3afbb58347c808ae76aaa41ca967d07.jpg",
                            "name": "tim1997"
                        },
                        "risk_ctrl_info": null
                    },
                    "guard": null,
                    "guard_leader": {
                        "is_guard_leader": false
                    },
                    "medal": {
                        "color": 2951253,//粉丝牌颜色(10进制)#2d0855
                        "color_border": 16771156,//粉丝牌边框颜色(10进制)#ffe854
                        "color_end": 10329087,//粉丝牌渐变颜色结束(10进制)#9d9bff
                        "color_start": 2951253,//粉丝牌渐变颜色开始(10进制)#2d0855
                        "guard_icon": "https://i0.hdslb.com/bfs/live/1d16bf0fcc3b1b768d1179d60f1fdbabe6ab4489.png",//粉丝牌左边的图标
                        "guard_level": 1,//类型 1.总督 2.提督 3,舰长
                        "honor_icon": "",
                        "id": 1279130,
                        "is_light": 1,
                        "level": 29,//粉丝牌等级
                        "name": "果咩吖",//粉丝牌名称
                        "ruid": 3546569288714792,//粉丝牌创建者UID
                        "score": 50427312,
                        "typ": 0,
                        "user_receive_count": 0,
                        "v2_medal_color_border": "#D47AFFFF",//粉丝牌边框颜色(APP)
                        "v2_medal_color_end": "#9660E5CC",//粉丝牌渐变颜色结束(APP)
                        "v2_medal_color_level": "#6C00A099",//粉丝牌右边等级数字颜色(APP)
                        "v2_medal_color_start": "#9660E5CC",//粉丝牌渐变颜色开始(APP)
                        "v2_medal_color_text": "#FFFFFFFF"//粉丝牌右边圆形颜色(APP)
                    },
                    "title": {
                        "old_title_css_id": "",
                        "title_css_id": ""
                    },
                    "uhead_frame": null,
                    "uid": 6088969,//弹幕发送用户UID
                    "wealth": null
                }
            },
            {
                "activity_identity": "",
                "activity_source": 0,
                "not_show": 0
            },
            0
        ],
        "白花300块[热]",//弹幕内容
        [
            6088969,//同info[0][15].user.uid
            "tim1997",//同info[0][15].user.base.name
            0,
            0,
            0,
            10000,
            1,
            ""
        ],
        [
            29,//同info[0][15].user.medal.level
            "果咩吖",//同info[0][15].user.medal.name
            "果宝Official",//粉丝牌创建主播名称
            31180317,
            2951253,//同info[0][15].user.medal.color
            "",
            0,
            16771156,//同info[0][15].user.medal.color_border
            2951253,//同info[0][15].user.medal.color_start
            10329087,//同info[0][15].user.medal.color_end
            1,//同info[0][15].user.medal.guard_level
            1,//同info[0][15].user.medal.is_light
            3546569288714792//同info[0][15].user.medal.ruid
        ],
        [
            39,
            0,
            10512625,
            42523,
            2
        ],
        [
            "",
            ""
        ],
        0,
        0,
        null,
        {
            "ct": "AFFF4206",
            "ts": 1723979200//时间戳(秒级)
        },
        0,
        0,
        null,
        null,
        0,
        1040,
        [
            49
        ],
        null
    ]
}
@yandujun363 yandujun363 changed the title [新增/更新请求] 对于 DANMU_MSG 事件数据的补充<title> [新增/更新请求] 对于 DANMU_MSG 事件数据的补充 Aug 18, 2024
@yandujun363
Copy link
Author

勘误
10进制颜色应转为以下格式

//9920249 -> rgb(99,202,49)
//2951253 -> rgb(29,51,253)
//其它同理

@yandujun363
Copy link
Author

勘误 10进制颜色应转为以下格式

//9920249 -> rgb(99,202,49)
//2951253 -> rgb(29,51,253)
//其它同理

我测试了一下,这个10进制颜色还是搞不明白,先用16进制的代替吧

@yandujun363
Copy link
Author

勘误 10进制颜色应转为以下格式

//9920249 -> rgb(99,202,49)
//2951253 -> rgb(29,51,253)
//其它同理

我测试了一下,这个10进制颜色还是搞不明白,先用16进制的代替吧

搞明白了原来是我没补齐位数

color_start = "#"+JSON.info[0][15].user.medal.color_start.toString(16).padStart(6,"0") //假如输入为3111,那么输出为#000C27

@z0z0r4 z0z0r4 added 新增/Add 添加或修改新的内容 直播/Live 接口:直播 弹幕/Danmaku 接口:弹幕 labels Aug 20, 2024
@SessionHu
Copy link
Contributor

感谢贡献 🙏

@yandujun363
Copy link
Author

最近发现发送的弹幕内容如果包含html标签,获取的数据不会对标签进行转义,请注意防范XSS攻击

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
新增/Add 添加或修改新的内容 弹幕/Danmaku 接口:弹幕 直播/Live 接口:直播
Projects
None yet
Development

No branches or pull requests

3 participants