抖音直播间:公屏信息解析(纯协议方式)

前言:

每每写博客都在凌晨,逆向这活不好干啊!!!眼看着头秃了,腰包却没有鼓起来。。。

        抖音直播间公屏信息解析,说白了就是将抖音直播间公屏上加密的数据小白化,然后直接拉取出来保存在本地,比如某某送了礼物、某某关注了主播、某某说了句什么话、某某分享了直播间等等,这些数据保存在本地后,可进行二次分析,具有一定的价值。

怎么实现:

        1、使用jadx反编译apk,或者反编译抖音apk包中对应的某一个dex即可;

        2、找到直播间相关文件(函数);

        3、分析关键函数,并抽取关键函数为己用;

        4、通过协议方式请求直播间数据(每间隔1秒请求一次),获取返回数据(返回数据是加密过的);

        5、对返回数据进行解密。

jadx:

抖音直播间:公屏信息解析(纯协议方式)_第1张图片

结果:

1、进入直播间消息:

{"action":1,"common":{"display_text":{"default_format":{"color":"#b8ffffff","weight":400},"default_pattern":"{0:user} 来了{1:string}","key":"live_room_enter_toast","pieces":[{"format":{"color":"#8CE7FF","weight":400},"type":11,"user_value":{"user":{"avatar_thumb":{"uri":"100x100/31b4100035fdb534a13bf","url_list":["https://p3-dy.byteimg.com/aweme/100x100/31b4100035fdb534a13bf.jpeg?from\u003d4010531038","https://p9-dy.byteimg.com/aweme/100x100/31b4100035fdb534a13bf.jpeg?from\u003d4010531038","https://p29-dy.byteimg.com/aweme/100x100/31b4100035fdb534a13bf.jpeg?from\u003d4010531038"]},"badge_image_list":[{"height":16,"image_type":1,"uri":"webcast/aweme_honor_level_icon_new_9.png","url_list":["http://p9-webcast-dycdn.byteimg.com/img/webcast/aweme_honor_level_icon_new_9.png~tplv-obj.image","http://p3-webcast-dycdn.byteimg.com/img/webcast/aweme_honor_level_icon_new_9.png~tplv-obj.image"],"width":32}],"display_id":"DY19940224","fans_club":{"data":{"available_gift_ids":[],"badge":{"icons":{"0":{"url_list":[]}}}},"prefer_data":{}},"follow_info":{"follower_count":1288,"following_count":1},"gender":1,"id":92401378365,"new_real_time_icons":[],"nickname":"百小格","pay_grade":{"grade_icon_list":[],"level":9,"new_im_icon_with_level":{"height":16,"image_type":1,"uri":"webcast/aweme_honor_level_icon_new_9.png","url_list":["http://p9-webcast-dycdn.byteimg.com/img/webcast/aweme_honor_level_icon_new_9.png~tplv-obj.image","http://p3-webcast-dycdn.byteimg.com/img/webcast/aweme_honor_level_icon_new_9.png~tplv-obj.image"],"width":32},"new_live_icon":{"height":12,"image_type":1,"uri":"webcast/aweme_pay_grade_2x_5_9.png","url_list":["http://p9-webcast-dycdn.byteimg.com/img/webcast/aweme_pay_grade_2x_5_9.png~tplv-obj.image","http://p1-webcast-dycdn.byteimg.com/img/webcast/aweme_pay_grade_2x_5_9.png~tplv-obj.image"],"width":12}},"real_time_icons":[],"sec_uid":"MS4wLjABAAAA9y_l6W8IqGhdMXCC7m0hE7nrCmYJc75tsvYSo-GJmaQ","short_id":3468880547,"top_fans":[],"user_attr":{}}}}]},"is_show_msg":true,"method":"WebcastMemberMessage","msg_id":6847185181007268612,"room_id":6847101220063021837},"member_count":6618,"user":{"avatar_thumb":{"uri":"100x100/31b4100035fdb534a13bf","url_list":["https://p3-dy.byteimg.com/aweme/100x100/31b4100035fdb534a13bf.jpeg?from\u003d4010531038","https://p9-dy.byteimg.com/aweme/100x100/31b4100035fdb534a13bf.jpeg?from\u003d4010531038","https://p29-dy.byteimg.com/aweme/100x100/31b4100035fdb534a13bf.jpeg?from\u003d4010531038"]},"badge_image_list":[{"height":16,"image_type":1,"uri":"webcast/aweme_honor_level_icon_new_9.png","url_list":["http://p9-webcast-dycdn.byteimg.com/img/webcast/aweme_honor_level_icon_new_9.png~tplv-obj.image","http://p3-webcast-dycdn.byteimg.com/img/webcast/aweme_honor_level_icon_new_9.png~tplv-obj.image"],"width":32}],"display_id":"DY19940224","fans_club":{"data":{"available_gift_ids":[],"badge":{"icons":{"0":{"url_list":[]}}}},"prefer_data":{}},"follow_info":{"follower_count":1288,"following_count":1},"gender":1,"id":92401378365,"new_real_time_icons":[],"nickname":"百小格","pay_grade":{"grade_icon_list":[],"level":1,"new_im_icon_with_level":{"height":16,"image_type":1,"uri":"webcast/aweme_honor_level_icon_new_9.png","url_list":["http://p9-webcast-dycdn.byteimg.com/img/webcast/aweme_honor_level_icon_new_9.png~tplv-obj.image","http://p3-webcast-dycdn.byteimg.com/img/webcast/aweme_honor_level_icon_new_9.png~tplv-obj.image"],"width":32},"new_live_icon":{"height":12,"image_type":1,"uri":"webcast/aweme_pay_grade_2x_5_9.png","url_list":["http://p9-webcast-dycdn.byteimg.com/img/webcast/aweme_pay_grade_2x_5_9.png~tplv-obj.image","http://p1-webcast-dycdn.byteimg.com/img/webcast/aweme_pay_grade_2x_5_9.png~tplv-obj.image"],"width":12}},"real_time_icons":[],"sec_uid":"MS4wLjABAAAA9y_l6W8IqGhdMXCC7m0hE7nrCmYJc75tsvYSo-GJmaQ","short_id":3468880547,"top_fans":[],"user_attr":{}}}

2、互动消息:

{"common":{"is_show_msg":true,"method":"WebcastChatMessage","msg_id":6847183653836016397,"room_id":6847101220063021837},"content":"待够半小时了,减一半才对","user":{"avatar_thumb":{"uri":"100x100/tos-cn-i-0813/e358f89f76d44b4b8fb94e2beabcd348","url_list":["https://p9-dy.byteimg.com/img/tos-cn-i-0813/e358f89f76d44b4b8fb94e2beabcd348~c5_100x100.jpeg?from\u003d4010531038","https://p6-dy-ipv6.byteimg.com/img/tos-cn-i-0813/e358f89f76d44b4b8fb94e2beabcd348~c5_100x100.jpeg?from\u003d4010531038","https://p3-dy.byteimg.com/img/tos-cn-i-0813/e358f89f76d44b4b8fb94e2beabcd348~c5_100x100.jpeg?from\u003d4010531038"]},"badge_image_list":[{"height":16,"image_type":1,"uri":"webcast/aweme_honor_level_icon_new_16.png","url_list":["http://p3-webcast-dycdn.byteimg.com/img/webcast/aweme_honor_level_icon_new_16.png~tplv-obj.image","http://p1-webcast-dycdn.byteimg.com/img/webcast/aweme_honor_level_icon_new_16.png~tplv-obj.image"],"width":32},{"image_type":7,"uri":"webcast/vcd_aweme_fansclub_7.png","url_list":["http://p1-webcast-dycdn.byteimg.com/img/webcast/vcd_aweme_fansclub_7.png~tplv-obj.image","http://p9-webcast-dycdn.byteimg.com/img/webcast/vcd_aweme_fansclub_7.png~tplv-obj.image"]}],"display_id":"590243102","fans_club":{"data":{"anchor_id":101216169856,"available_gift_ids":[],"badge":{"icons":{"2":{"uri":"webcast/vcd_aweme_fansclub_7.png","url_list":["http://p1-webcast-dycdn.byteimg.com/img/webcast/vcd_aweme_fansclub_7.png~tplv-obj.image","http://p9-webcast-dycdn.byteimg.com/img/webcast/vcd_aweme_fansclub_7.png~tplv-obj.image"]}},"title":"浩家军"},"club_name":"浩家军","level":7,"user_fans_club_status":"Active"},"prefer_data":{"1":{"anchor_id":101216169856,"available_gift_ids":[],"badge":{"icons":{"2":{"uri":"webcast/vcd_aweme_fansclub_7.png","url_list":["http://p6-webcast-dycdn.byteimg.com/img/webcast/vcd_aweme_fansclub_7.png~tplv-obj.image","http://p9-webcast-dycdn.byteimg.com/img/webcast/vcd_aweme_fansclub_7.png~tplv-obj.image"]}},"title":"浩家军"},"club_name":"浩家军","level":7,"user_fans_club_status":"Active"}}},"follow_info":{"follower_count":1,"following_count":59},"gender":2,"id":61011336108,"new_real_time_icons":[],"nickname":"小小小小太阳吖","pay_grade":{"grade_icon_list":[],"level":16,"new_im_icon_with_level":{"height":16,"image_type":1,"uri":"webcast/aweme_honor_level_icon_new_16.png","url_list":["http://p3-webcast-dycdn.byteimg.com/img/webcast/aweme_honor_level_icon_new_16.png~tplv-obj.image","http://p1-webcast-dycdn.byteimg.com/img/webcast/aweme_honor_level_icon_new_16.png~tplv-obj.image"],"width":32},"new_live_icon":{"height":12,"image_type":1,"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}},"real_time_icons":[],"sec_uid":"MS4wLjABAAAAstlNFvda1TAA3kuzDIzu_sYVO3TE4_Ft_7c3BVE04Tc","short_id":590243102,"top_fans":[],"user_attr":{}}}

3、关注主播消息:

{"action":1,"common":{"display_text":{"default_format":{"color":"#8CE7FF","weight":400},"default_pattern":"{0:user} 关注了主播","key":"room_follow_msg","pieces":[{"type":11,"user_value":{"user":{"avatar_thumb":{"uri":"100x100/2fa2b0007d682105807df","url_list":["https://p9-dy-ipv6.byteimg.com/aweme/100x100/2fa2b0007d682105807df.jpeg?from\u003d4010531038","https://p6-dy-ipv6.byteimg.com/aweme/100x100/2fa2b0007d682105807df.jpeg?from\u003d4010531038","https://p3-dy.byteimg.com/aweme/100x100/2fa2b0007d682105807df.jpeg?from\u003d4010531038"]},"badge_image_list":[{"height":16,"image_type":1,"uri":"webcast/aweme_honor_level_icon_new_16.png","url_list":["http://p9-webcast-dycdn.byteimg.com/img/webcast/aweme_honor_level_icon_new_16.png~tplv-obj.image","http://p1-webcast-dycdn.byteimg.com/img/webcast/aweme_honor_level_icon_new_16.png~tplv-obj.image"],"width":32}],"display_id":"hwly1818","fans_club":{"data":{"available_gift_ids":[],"badge":{"icons":{"0":{"url_list":[]}}}},"prefer_data":{}},"follow_info":{"follower_count":120,"following_count":215},"gender":2,"id":109071585746,"new_real_time_icons":[],"nickname":"珠珠看世界","pay_grade":{"grade_icon_list":[],"level":16,"new_im_icon_with_level":{"height":16,"image_type":1,"uri":"webcast/aweme_honor_level_icon_new_16.png","url_list":["http://p9-webcast-dycdn.byteimg.com/img/webcast/aweme_honor_level_icon_new_16.png~tplv-obj.image","http://p1-webcast-dycdn.byteimg.com/img/webcast/aweme_honor_level_icon_new_16.png~tplv-obj.image"],"width":32},"new_live_icon":{"height":12,"image_type":1,"uri":"webcast/aweme_pay_grade_2x_15_19.png","url_list":["http://p1-webcast-dycdn.byteimg.com/img/webcast/aweme_pay_grade_2x_15_19.png~tplv-obj.image","http://p9-webcast-dycdn.byteimg.com/img/webcast/aweme_pay_grade_2x_15_19.png~tplv-obj.image"],"width":12}},"real_time_icons":[],"sec_uid":"MS4wLjABAAAA7109KnhzwVFBuYhNC_cY5JsyqWN787qX3qgUQpr9NqA","short_id":1843245016,"top_fans":[],"user_attr":{}}}}]},"is_show_msg":true,"method":"WebcastSocialMessage","msg_id":6847185487921367819,"room_id":6847101220063021837},"follow_count":276533,"share_target":"101216169856","user":{"avatar_thumb":{"uri":"100x100/2fa2b0007d682105807df","url_list":["https://p9-dy-ipv6.byteimg.com/aweme/100x100/2fa2b0007d682105807df.jpeg?from\u003d4010531038","https://p6-dy-ipv6.byteimg.com/aweme/100x100/2fa2b0007d682105807df.jpeg?from\u003d4010531038","https://p3-dy.byteimg.com/aweme/100x100/2fa2b0007d682105807df.jpeg?from\u003d4010531038"]},"badge_image_list":[{"height":16,"image_type":1,"uri":"webcast/aweme_honor_level_icon_new_16.png","url_list":["http://p9-webcast-dycdn.byteimg.com/img/webcast/aweme_honor_level_icon_new_16.png~tplv-obj.image","http://p1-webcast-dycdn.byteimg.com/img/webcast/aweme_honor_level_icon_new_16.png~tplv-obj.image"],"width":32}],"display_id":"hwly1818","fans_club":{"data":{"available_gift_ids":[],"badge":{"icons":{"0":{"url_list":[]}}}},"prefer_data":{}},"follow_info":{"follower_count":120,"following_count":215},"gender":2,"id":109071585746,"new_real_time_icons":[],"nickname":"珠珠看世界","pay_grade":{"grade_icon_list":[],"level":16,"new_im_icon_with_level":{"height":16,"image_type":1,"uri":"webcast/aweme_honor_level_icon_new_16.png","url_list":["http://p9-webcast-dycdn.byteimg.com/img/webcast/aweme_honor_level_icon_new_16.png~tplv-obj.image","http://p1-webcast-dycdn.byteimg.com/img/webcast/aweme_honor_level_icon_new_16.png~tplv-obj.image"],"width":32},"new_live_icon":{"height":12,"image_type":1,"uri":"webcast/aweme_pay_grade_2x_15_19.png","url_list":["http://p1-webcast-dycdn.byteimg.com/img/webcast/aweme_pay_grade_2x_15_19.png~tplv-obj.image","http://p9-webcast-dycdn.byteimg.com/img/webcast/aweme_pay_grade_2x_15_19.png~tplv-obj.image"],"width":12}},"real_time_icons":[],"sec_uid":"MS4wLjABAAAA7109KnhzwVFBuYhNC_cY5JsyqWN787qX3qgUQpr9NqA","short_id":1843245016,"top_fans":[],"user_attr":{}}}

4、送礼物消息:

{"combo_count":1,"common":{"create_time":1594234647302,"describe":"袁先生:送给主播 1个粉丝团灯牌","display_text":{"default_format":{"color":"#ffface15","weight":400},"default_pattern":"{0:user} 送出{1:gift} {2:string}","key":"webcast_aweme_gift_send_message","pieces":[{"format":{"color":"#ff8ce7ff","weight":400},"type":11,"user_value":{"user":{"avatar_thumb":{"uri":"100x100/1cab700074a01ee5ab1f2","url_list":["https://p3-dy-ipv6.byteimg.com/aweme/100x100/1cab700074a01ee5ab1f2.jpeg?from\u003d4010531038","https://p1-dy.byteimg.com/aweme/100x100/1cab700074a01ee5ab1f2.jpeg?from\u003d4010531038","https://p29-dy.byteimg.com/aweme/100x100/1cab700074a01ee5ab1f2.jpeg?from\u003d4010531038"]},"badge_image_list":[{"height":16,"image_type":1,"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://p1-webcast-dycdn.byteimg.com/img/webcast/aweme_honor_level_icon_new_16.png~tplv-obj.image"],"width":32}],"display_id":"qixin666666","fans_club":{"data":{"anchor_id":101216169856,"available_gift_ids":[],"badge":{"icons":{"2":{"uri":"webcast/vcd_aweme_fansclub_1_lightdown.png","url_list":["http://p1-webcast-dycdn.byteimg.com/img/webcast/vcd_aweme_fansclub_1_lightdown.png~tplv-obj.image","http://p9-webcast-dycdn.byteimg.com/img/webcast/vcd_aweme_fansclub_1_lightdown.png~tplv-obj.image"]}},"title":"浩家军"},"club_name":"浩家军","level":1,"user_fans_club_status":"Inactive"},"prefer_data":{"1":{"anchor_id":84064249580,"available_gift_ids":[],"badge":{"icons":{"2":{"uri":"webcast/vcd_aweme_fansclub_10.png","url_list":["http://p3-webcast-dycdn.byteimg.com/img/webcast/vcd_aweme_fansclub_10.png~tplv-obj.image","http://p1-webcast-dycdn.byteimg.com/img/webcast/vcd_aweme_fansclub_10.png~tplv-obj.image"]}},"title":"忠哥"},"club_name":"忠哥","level":10,"user_fans_club_status":"Active"}}},"follow_info":{"follower_count":208,"following_count":1638},"gender":1,"id":98130261360,"new_real_time_icons":[],"nickname":"袁先生","pay_grade":{"grade_icon_list":[],"level":16,"new_im_icon_with_level":{"height":16,"image_type":1,"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://p1-webcast-dycdn.byteimg.com/img/webcast/aweme_honor_level_icon_new_16.png~tplv-obj.image"],"width":32},"new_live_icon":{"height":12,"image_type":1,"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://p3-webcast-dycdn.byteimg.com/img/webcast/aweme_pay_grade_2x_15_19.png~tplv-obj.image"],"width":12}},"real_time_icons":[],"sec_uid":"MS4wLjABAAAA61jKrUdA8bYNRf4rKEFzLBEcvLbJvvNgcmCp1oxCxZg","short_id":913977124,"top_fans":[],"user_attr":{}}}},{"gift_value":{"gift_id":685,"name_ref":{"default_pattern":"粉丝团灯牌","key":"live_gift_685"}},"type":12},{"format":{"color":"#ffface15","weight":400},"string_value":"x1","type":1}]},"is_show_msg":true,"method":"WebcastGiftMessage","msg_id":6847180931372075789,"room_id":6847101220063021837},"fan_ticket_count":446900824,"gift_id":685,"group_count":1,"repeat_count":1,"room_fan_ticket_count":4356714,"user":{"avatar_thumb":{"uri":"100x100/1cab700074a01ee5ab1f2","url_list":["https://p3-dy-ipv6.byteimg.com/aweme/100x100/1cab700074a01ee5ab1f2.jpeg?from\u003d4010531038","https://p1-dy.byteimg.com/aweme/100x100/1cab700074a01ee5ab1f2.jpeg?from\u003d4010531038","https://p29-dy.byteimg.com/aweme/100x100/1cab700074a01ee5ab1f2.jpeg?from\u003d4010531038"]},"badge_image_list":[{"height":16,"image_type":1,"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://p1-webcast-dycdn.byteimg.com/img/webcast/aweme_honor_level_icon_new_16.png~tplv-obj.image"],"width":32}],"display_id":"qixin666666","fans_club":{"data":{"anchor_id":101216169856,"available_gift_ids":[],"badge":{"icons":{"2":{"uri":"webcast/vcd_aweme_fansclub_1_lightdown.png","url_list":["http://p1-webcast-dycdn.byteimg.com/img/webcast/vcd_aweme_fansclub_1_lightdown.png~tplv-obj.image","http://p9-webcast-dycdn.byteimg.com/img/webcast/vcd_aweme_fansclub_1_lightdown.png~tplv-obj.image"]}},"title":"浩家军"},"club_name":"浩家军","level":1,"user_fans_club_status":"Inactive"},"prefer_data":{"1":{"anchor_id":84064249580,"available_gift_ids":[],"badge":{"icons":{"2":{"uri":"webcast/vcd_aweme_fansclub_10.png","url_list":["http://p3-webcast-dycdn.byteimg.com/img/webcast/vcd_aweme_fansclub_10.png~tplv-obj.image","http://p1-webcast-dycdn.byteimg.com/img/webcast/vcd_aweme_fansclub_10.png~tplv-obj.image"]}},"title":"忠哥"},"club_name":"忠哥","level":10,"user_fans_club_status":"Active"}}},"follow_info":{"follower_count":208,"following_count":1638},"gender":1,"id":98130261360,"new_real_time_icons":[],"nickname":"袁先生","pay_grade":{"grade_icon_list":[],"level":16,"new_im_icon_with_level":{"height":16,"image_type":1,"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://p1-webcast-dycdn.byteimg.com/img/webcast/aweme_honor_level_icon_new_16.png~tplv-obj.image"],"width":32},"new_live_icon":{"height":12,"image_type":1,"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://p3-webcast-dycdn.byteimg.com/img/webcast/aweme_pay_grade_2x_15_19.png~tplv-obj.image"],"width":12}},"real_time_icons":[],"sec_uid":"MS4wLjABAAAA61jKrUdA8bYNRf4rKEFzLBEcvLbJvvNgcmCp1oxCxZg","short_id":913977124,"top_fans":[],"user_attr":{}}}

还有很多其他公屏上的信息可以解析出来,就不一一列举了...

做了一个动图,大伙感受下:

抖音直播间:公屏信息解析(纯协议方式)_第2张图片

纯协议,无需什么模拟器脚本什么的,是不是很完美!!!

交流合作请加我vx:YY_yhzf

你可能感兴趣的:(抖音设备注册,爬虫技术,直播人气)