抖音实时弹幕和礼物信息数据接口采集,/douyin/liveroom/audience

抖音实时弹幕和礼物信息数据接口采集,/douyin/liveroom/audience

实时弹幕和礼物信息数据接口

请求Api

http://主机地址/douyin/liveroom/chat?token=xxx&room_id=6843198199583378191

请求方式

GET

参数

字段类型说明
tokenstring接口授权码
room_idint直播间id

了解更多短视频直播数据采集分析接口请点击查看接口文档

返回示例

{
    "code": 200,
    "msg": "成功",
    "data": {
        "messages": [
            {
                "method": "WebcastRoomIntroMessage",
                "msg_id": 6888847779519534083,
                "payload": {
                    "room_id": 0,
                    "content": "这里是TeenieWeenie官方直播间,欢迎熊粉们常来玩,主播在这里等你们哟~",
                    "user": {
                        "uid": 8401565526815,
                        "nickname": "TeenieWeenie女装官方旗舰店",
                        "unique_id": "teenieweenie_",
                        "sec_uid": "MS4wLjABAAAAGYEe4uJArJ3uYEmO7dNXrbRBVmuRWG7a1PGtI7E9W9Q"
                    }
                }
            },
            {
                "method": "WebcastChatMessage",
                "msg_id": 6922636275858098944,
                "payload": {
                    "room_id": 6922580638159719176,
                    "content": "想要长款连衣裙",
                    "user": {
                        "uid": 61152922824,
                        "nickname": "若他",
                        "unique_id": "834508049",
                        "sec_uid": "MS4wLjABAAAAofSXImUFD30Qi7j1fV66kn0U7VinMZwzVkAfQnHZFvg"
                    }
                }
            },
            {
                "method": "WebcastChatMessage",
                "msg_id": 6922636320099633933,
                "payload": {
                    "room_id": 6922580638159719176,
                    "content": "23号大衣还有吗 可以回复一下吗",
                    "user": {
                        "uid": 60722721614,
                        "nickname": "妞儿小念",
                        "unique_id": "103191973",
                        "sec_uid": "MS4wLjABAAAA0TFnVB4zTu3wFzhiiSOJ3EnZy4zey4XcFTgvkAAtMh8"
                    }
                }
            },
            {
                "method": "WebcastChatMessage",
                "msg_id": 6922636312495606535,
                "payload": {
                    "room_id": 6922580638159719176,
                    "content": "我买了十多件,不想要不能退吗",
                    "user": {
                        "uid": 107986518524,
                        "nickname": "娥子",
                        "unique_id": "1784059460",
                        "sec_uid": "MS4wLjABAAAA7l8_XLtA8c3FRMGoVabe7tagHNjkPhaLNhmumtVDx4Y"
                    }
                }
            },
            {
                "method": "WebcastMemberMessage",
                "msg_id": 6922636419634629379,
                "payload": {
                    "room_id": 6922580638159719176,
                    "content": "来了",
                    "user": {
                        "uid": 88621488902,
                        "nickname": "L@",
                        "unique_id": "1123271264",
                        "sec_uid": "MS4wLjABAAAAEkGEcrpL8ulIZZ7mF0JQvMMHcSmTQho4QUedUtWCftA"
                    }
                }
            },
            {
                "method": "WebcastMemberMessage",
                "msg_id": 6922636420838837000,
                "payload": {
                    "room_id": 6922580638159719176,
                    "content": "来了",
                    "user": {
                        "uid": 52698179946,
                        "nickname": "美好明天",
                        "unique_id": "hxp99901",
                        "sec_uid": "MS4wLjABAAAAkXJLP99bv_4Jkh9KzSZEzAvqRFfLPmODrMLWX0ADsoM"
                    }
                }
            },
            {
                "method": "WebcastMemberMessage",
                "msg_id": 6922636422784764686,
                "payload": {
                    "room_id": 6922580638159719176,
                    "content": "来了",
                    "user": {
                        "uid": 51923147039,
                        "nickname": "冬冬",
                        "unique_id": "1041741043",
                        "sec_uid": "MS4wLjABAAAAXkhMk7r1p83SkWRFgpwvpd6ASlB3I-YMDl2JZW66eeQ"
                    }
                }
            },
            {
                "method": "WebcastLikeMessage",
                "msg_id": 6922636425427503886,
                "payload": {
                    "room_id": 6922580638159719176,
                    "content": "点赞",
                    "user": {
                        "uid": 105308683391,
                        "nickname": "☀️太阳 Angel",
                        "unique_id": "Angel2020168",
                        "sec_uid": "MS4wLjABAAAAnkvgZhcaRKRppWqyuUWamJuRtipXMlSHscyB-eS9wE0"
                    }
                }
            },
            {
                "method": "WebcastChatMessage",
                "msg_id": 6922636332913199880,
                "payload": {
                    "room_id": 6922580638159719176,
                    "content": "23号大衣可以回复一下吗",
                    "user": {
                        "uid": 60722721614,
                        "nickname": "妞儿小念",
                        "unique_id": "103191973",
                        "sec_uid": "MS4wLjABAAAA0TFnVB4zTu3wFzhiiSOJ3EnZy4zey4XcFTgvkAAtMh8"
                    }
                }
            },
            {
                "method": "WebcastMemberMessage",
                "msg_id": 6922636426312370957,
                "payload": {
                    "room_id": 6922580638159719176,
                    "content": "来了",
                    "user": {
                        "uid": 78218887998,
                        "nickname": "媛媛(●—●)",
                        "unique_id": "366527366",
                        "sec_uid": "MS4wLjABAAAAYpZ-oieBEOjLtIRAbyiuV9ehmrQd1p1GYkT-uzVDBNk"
                    }
                }
            },
            {
                "method": "WebcastSocialMessage",
                "msg_id": 6922636431550679822,
                "payload": {
                    "room_id": 6922580638159719176,
                    "content": "关注了主播",
                    "user": {
                        "uid": 1543327509393740,
                        "nickname": "安好…",
                        "unique_id": "dyl5gnds85en",
                        "sec_uid": "MS4wLjABAAAApHPePKMI-9rxbC_ZXW-8Lp-uPmGywJlDFgsX1O_MMKrin6E5AKmEtTfLkzwDIcrS"
                    }
                }
            },
            {
                "method": "WebcastMemberMessage",
                "msg_id": 6922636429608733454,
                "payload": {
                    "room_id": 6922580638159719176,
                    "content": "来了",
                    "user": {
                        "uid": 62480612210,
                        "nickname": "是花花啊🥨",
                        "unique_id": "Meng1025_",
                        "sec_uid": "MS4wLjABAAAAtK3lUOvcyvQW-zD6MZiqXDDN5AyLDDRwamW4dZ3TCi0"
                    }
                }
            },
            {
                "method": "WebcastGiftMessage",
                "msg_id": 6922631970493106951,
                "payload": {
                    "room_id": 6922580638159719176,
                    "content": "用户6403941818064:送给主播 1个小心心",
                    "user": {
                        "uid": 3729150495435053,
                        "nickname": "用户6403941818064",
                        "unique_id": "dynxkkjzy929",
                        "sec_uid": "MS4wLjABAAAAeDzhQtIcCnVSxRh31oUXC6hfi92Eg0MfLH1-XaOm6DHjbIczVjcEnowr2Y6XIEaZ"
                    }
                }
            },
            {
                "method": "WebcastMemberMessage",
                "msg_id": 6922636428334205700,
                "payload": {
                    "room_id": 6922580638159719176,
                    "content": "来了",
                    "user": {
                        "uid": 68489185854,
                        "nickname": "可爱再多一点😋",
                        "unique_id": "93804960",
                        "sec_uid": "MS4wLjABAAAARQgcmfArG31g_4RteEaMGjbPmnUAu5FKNzKUoGX9TUw"
                    }
                }
            }
        ],
        "cursor": "1611801897133_6922636435245915553_1_1",
        "fetch_interval": 1000,
        "now": 1611801897133,
        "internal_ext": "fetch_time:1611801897133|start_time:1611801885555|ack_ids:6922636386029931272_107c,6922636383869831944_107c,6922636381571664647_107c,6922636382708468494_107e,6922636384503188235_1080,6922636392137624328_1082,6922636391746702084_1082,6922636391746718468_1082,6922636396302486280_1084,6922636401926228747_1086,6922636398407305987_1086,6922636399431093006_1086,6922636403406981899_1088,6922636406481373959_108a,6922636239049132800_108a,6922636408494689028_108a,6922636417961052935_108e,6922636416887704331_108e,6922636426312387341_1092,6922636427234822919_1092,6922636427368975111_1092,6922631970493106951_1094|flag:1|seq:1|next_cursor:1611801897133_6922636435245915553_1_1|door:6-n3",
        "ignores": [
            "WebcastRoomMessage",
            "WebcastLiveEcomMessage",
            "WebcastRoomUserSeqMessage"
        ]
    }
}

直播间音浪榜、用户等级数据接口

请求Api

http://主机地址/douyin/liveroom/audience?token=xxx&room_id=6843198199583378191

请求方式

GET

参数

字段类型说明
tokenstring接口授权码
room_idint直播间id

返回示例


{
    "code": 200,
    "data": {
        "data": {
            "currency": "音浪",
            "has_more": false,
            "has_once_live": true,
            "music_wave": "音浪",
            "ranks": [
                {
                    "delta": 0,
                    "first_gift": false,
                    "gap_description": "99",
                    "rank": 1,
                    "score": 99,
                    "user": {
                        "adversary_authorization_info": 0,
                        "adversary_user_status": 0,
                        "allow_be_located": false,
                        "allow_find_by_contacts": false,
                        "allow_others_download_video": false,
                        "allow_others_download_when_sharing_video": false,
                        "allow_share_show_profile": false,
                        "allow_show_in_gossip": false,
                        "allow_show_my_action": false,
                        "allow_strange_comment": false,
                        "allow_unfollower_comment": false,
                        "allow_use_linkmic": false,
                        "authorization_info": 3,
                        "avatar_thumb": {
                            "avg_color": "",
                            "height": 0,
                            "image_type": 0,
                            "is_animated": false,
                            "open_web_url": "",
                            "uri": "100x100/316e3000c72bee4420e2d",
                            "url_list": [
                                "https://p3-dy-ipv6.byteimg.com/aweme/100x100/316e3000c72bee4420e2d.jpeg?from=4010531038",
                                "https://p6-dy-ipv6.byteimg.com/aweme/100x100/316e3000c72bee4420e2d.jpeg?from=4010531038",
                                "https://p26-dy.byteimg.com/aweme/100x100/316e3000c72bee4420e2d.jpeg?from=4010531038"
                            ],
                            "width": 0
                        },
                        "badge_image_list": [],
                        "bg_img_url": "",
                        "birthday": 0,
                        "birthday_description": "",
                        "birthday_valid": false,
                        "block_status": 0,
                        "city": "",
                        "comment_restrict": 0,
                        "commerce_webcast_config_ids": [],
                        "constellation": "",
                        "create_time": 0,
                        "disable_ichat": 0,
                        "display_id": "385190430",
                        "enable_ichat_img": 0,
                        "exp": 0,
                        "experience": 0,
                        "fan_ticket_count": 0,
                        "fans_club": {
                            "data": {
                                "anchor_id": 0,
                                "available_gift_ids": [],
                                "badge": {
                                    "icons": {
                                        "0": {
                                            "avg_color": "",
                                            "height": 0,
                                            "image_type": 0,
                                            "is_animated": false,
                                            "open_web_url": "",
                                            "uri": "",
                                            "url_list": [],
                                            "width": 0
                                        }
                                    },
                                    "title": ""
                                },
                                "club_name": "",
                                "level": 0,
                                "user_fans_club_status": 0
                            },
                            "prefer_data": {}
                        },
                        "fold_stranger_chat": false,
                        "follow_info": {
                            "follow_status": 0,
                            "follower_count": 0,
                            "following_count": 0,
                            "push_status": 0
                        },
                        "follow_status": 0,
                        "gender": 0,
                        "hotsoon_verified": false,
                        "hotsoon_verified_reason": "",
                        "ichat_restrict_type": 0,
                        "id": 66287019758,
                        "id_str": "66287019758",
                        "income_share_percent": 0,
                        "is_follower": false,
                        "is_following": false,
                        "level": 0,
                        "link_mic_stats": 0,
                        "media_badge_image_list": [],
                        "modify_time": 0,
                        "need_profile_guide": false,
                        "new_real_time_icons": [],
                        "nickname": "吉森",
                        "pay_grade": {
                            "grade_banner": "",
                            "grade_describe": "距离17级还差3抖币",
                            "grade_icon_list": [],
                            "level": 16,
                            "name": "",
                            "new_im_icon_with_level": {
                                "avg_color": "",
                                "height": 16,
                                "image_type": 1,
                                "is_animated": false,
                                "open_web_url": "",
                                "uri": "webcast/aweme_honor_level_icon_new_16.png",
                                "url_list": [
                                    "http://p6-webcast-dycdn.byteimg.com/img/webcast/aweme_honor_level_icon_new_16.png~tplv-obj.image",
                                    "http://p9-webcast-dycdn.byteimg.com/img/webcast/aweme_honor_level_icon_new_16.png~tplv-obj.image"
                                ],
                                "width": 32
                            },
                            "new_live_icon": {
                                "avg_color": "",
                                "height": 12,
                                "image_type": 1,
                                "is_animated": false,
                                "open_web_url": "",
                                "uri": "webcast/aweme_pay_grade_2x_15_19.png",
                                "url_list": [
                                    "http://p6-webcast-dycdn.byteimg.com/img/webcast/aweme_pay_grade_2x_15_19.png~tplv-obj.image",
                                    "http://p1-webcast-dycdn.byteimg.com/img/webcast/aweme_pay_grade_2x_15_19.png~tplv-obj.image"
                                ],
                                "width": 12
                            },
                            "next_diamond": 0,
                            "next_name": "",
                            "next_privileges": "",
                            "now_diamond": 0,
                            "pay_diamond_bak": 0,
                            "score": 1697,
                            "screen_chat_type": 0,
                            "this_grade_max_diamond": 1700,
                            "this_grade_min_diamond": 1300,
                            "total_diamond_count": 1697,
                            "upgrade_need_consume": 0
                        },
                        "pay_score": 0,
                        "pay_scores": 0,
                        "push_comment_status": false,
                        "push_digg": false,
                        "push_follow": false,
                        "push_friend_action": false,
                        "push_ichat": false,
                        "push_status": false,
                        "push_video_post": false,
                        "push_video_recommend": false,
                        "real_time_icons": [],
                        "sec_uid": "MS4wLjABAAAABkK4jcEax0iVyUVnrSH3Q63wM6vRb_OlpK0Zd9DbcwE",
                        "secret": 0,
                        "share_qrcode_uri": "",
                        "short_id": 385190430,
                        "signature": "",
                        "special_id": "",
                        "status": 0,
                        "telephone": "",
                        "ticket_count": 0,
                        "top_fans": [],
                        "top_vip_no": 0,
                        "total_recharge_diamond_count": 0,
                        "user_role": 0,
                        "verified": false,
                        "verified_content": "",
                        "verified_mobile": false,
                        "verified_reason": "",
                        "with_car_management_permission": false,
                        "with_commerce_permission": false,
                        "with_fusion_shop_entry": false
                    }
                },
            ],
            "rules_url": "sslocal://webcast_webview?url=https%3A%2F%2Faweme.snssdk.com%2Fmagic%2Fpage%2Fejs%2F5f27c6ca9950ec0307de9248%3FappType%3Ddouyin%26pull_down_indicator_color%3Ddark%26pull_down_indicator_not_show%3D0%26web_bg_color%3D%2523ffffffff&pull_down_close=0&pull_down_indicator_not_show=1&pull_down_indicator_color=dark&type=popup&gravity=bottom&height=450&radius=8&hide_more=0&hide_nav_bar=0&hide_status_bar=0&landscape_custom_width=1&rate_height=450",
            "seats": [],
            "self_info": {
                "delta": 0,
                "first_gift": false,
                "gap_description": "本场贡献:0音浪",
                "rank": 0,
                "score": 0
            },
            "total": 0
        },
        "extra": {
            "now": 1600957337628
        },
        "status_code": 0
    },
    "msg": "success"
}
  • 6
    点赞
  • 86
    收藏
    觉得还不错? 一键收藏
  • 12
    评论
要用Python采集抖音弹幕,可以使用Selenium和BeautifulSoup这两个库。 首先,我们需要安装这两个库,可以使用pip命令进行安装。在命令行中输入以下命令: pip install selenium pip install beautifulsoup4 接下来,我们需要安装Chrome浏览器和对应版本的ChromeDriver。可以在Chrome官网下载Chrome浏览器,然后在ChromeDriver官网下载对应版本的ChromeDriver,并将ChromeDriver放在合适的地方。 然后,我们需要打开Chrome浏览器并访问抖音网页。我们可以使用Selenium库来控制浏览器操作。下面是一个示例代码: ``` from selenium import webdriver # 设置ChromeDriver路径 chrome_driver_path = "path_to_chromedriver" # 创建Chrome浏览器实例 driver = webdriver.Chrome(executable_path=chrome_driver_path) # 打开抖音网页 driver.get("https://www.douyin.com/XXXX") # 获取弹幕 douyin_comments = driver.find_elements_by_class_name("douyin-comment") # 遍历弹幕并输出 for comment in douyin_comments: print(comment.text) # 关闭浏览器 driver.quit() ``` 在代码中,我们首先设置了ChromeDriver的路径,然后通过webdriver.Chrome方法创建了一个Chrome浏览器实例。接着,使用driver.get方法打开了抖音网页。然后,我们通过driver.find_elements_by_class_name方法获取了所有的弹幕元素,并遍历输出每个弹幕的文本。最后,使用driver.quit方法关闭了浏览器。 此外,我们可以使用BeautifulSoup库对网页源代码进行解析,以方便从中提取所需的信息。具体代码如下: ``` from bs4 import BeautifulSoup # 使用BeautifulSoup解析网页源代码 soup = BeautifulSoup(driver.page_source, 'html.parser') # 获取弹幕 douyin_comments = soup.find_all("div", class_="douyin-comment") # 遍历弹幕并输出 for comment in douyin_comments: print(comment.text) ``` 在代码中,我们首先导入了BeautifulSoup库,然后使用BeautifulSoup方法解析了driver.page_source,即浏览器当前页面的源代码。接着,我们使用find_all方法找到所有class属性为"douyin-comment"的div元素,即弹幕元素,并遍历输出每个弹幕的文本。 使用以上方法,我们可以用Python采集抖音弹幕
评论 12
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值