diff --git a/Demo/XiguaMessage.proto b/Demo/XiguaMessage.proto index dee3acb..43d4135 100644 --- a/Demo/XiguaMessage.proto +++ b/Demo/XiguaMessage.proto @@ -9,10 +9,16 @@ message Message { } message FansClubMessage { required CommonInfo commonInfo = 1; - required int32 someEnum = 2; - required int32 someInt3 = 3; + // 0没有 1有且是本直播间 + required int32 type = 2; + required string content = 3; required User user = 4; } +message FansClubStatsMessage { + required CommonInfo commonInfo = 1; + required string title = 2; + required int32 count = 3; +} message UserSeqMessage { required CommonInfo commonInfo = 1; required string popularityText = 4; @@ -41,7 +47,7 @@ message GiftMessage { // 5,6 顺序可能不对 required int32 repeated = 5; required int32 combo = 6; - required User user = 7; + optional User user = 7; optional bool isFinished = 9 [ default = false ]; } // 样式 diff --git a/Demo/XiguaUser.proto b/Demo/XiguaUser.proto index e008204..7322b45 100644 --- a/Demo/XiguaUser.proto +++ b/Demo/XiguaUser.proto @@ -11,7 +11,7 @@ message Badge { required int32 level = 3; } repeated string url = 1; - optional string localUrl = 2; +// optional string localUrl = 2; optional int32 height = 3; optional int32 width = 4; // 3 房管 @@ -21,16 +21,11 @@ message Badge { optional string clickTo = 7; optional FanClubText fanClubText = 8; } -message FansClubBadgePack { - required Badge badge = 1; - optional string title = 2 [default = '']; -} message FansClubPack { message FansClub { required string title = 1 [default = '']; required int32 level = 2 [default = 0]; optional int32 someEnum = 3; - required FansClubBadgePack fansClubs = 4; } required FansClub fansClub = 1; } diff --git a/Demo/fst.txt b/Demo/fst.txt new file mode 100644 index 0000000..977f297 Binary files /dev/null and b/Demo/fst.txt differ diff --git a/Demo/resultfst.txt b/Demo/resultfst.txt new file mode 100644 index 0000000..63133b2 --- /dev/null +++ b/Demo/resultfst.txt @@ -0,0 +1,862 @@ +1 { + 1: "WebcastMemberMessage" + 2 { + 1 { + 1: "WebcastMemberMessage" + 2: 6776965782439283463 + 3: 6776895930592398094 + 6: 1 + 8 { + 1: "live_room_enter_toast" + 2: "{0:user} \346\235\245\344\272\206{1:string}" + 3 { + 1: "#de000000" + 4: 400 + } + 4 { + 1: 11 + 2 { + 1: "#61000000" + 4: 400 + } + 21 { + 1 { + 1: 1587335753631549 + 3: "\345\260\217\345\244\251\346\211\215\350\264\235\345\243\263" + 9 { + 1: "http://p3.pstatp.com/thumb/3793/3131589739" + 2: "3793/3131589739" + } + 22 { + 1: 33 + 2: 2 + } + 23 { + 19: "" + } + 24 { + 1 { + 4 { + 1 { + 1: 0 + 2: "" + } + } + } + } + 32: "" + 38: "0" + 46: "MS4wLjABAAAAh0jOEAHZj6-a55dwsKu6i0ilHwHcWPx8mLImJ5iDJzfgkYhU0mFv-oLZ6yx6wNi0" + } + } + } + } + } + 2 { + 1: 1587335753631549 + 3: "\345\260\217\345\244\251\346\211\215\350\264\235\345\243\263" + 9 { + 1: "http://p3.pstatp.com/thumb/3793/3131589739" + 2: "3793/3131589739" + } + 22 { + 1: 33 + 2: 2 + } + 23 { + 19: "" + } + 24 { + 1 { + 4 { + 1 { + 1: 0 + 2: "" + } + } + } + } + 32: "" + 38: "0" + 46: "MS4wLjABAAAAh0jOEAHZj6-a55dwsKu6i0ilHwHcWPx8mLImJ5iDJzfgkYhU0mFv-oLZ6yx6wNi0" + } + 3: 15103 + 10: 1 + 14: "132\344\270\207\344\272\272\346\260\224" + } +} +1 { + 1: "WebcastMemberMessage" + 2 { + 1 { + 1: "WebcastMemberMessage" + 2: 6776965783190555404 + 3: 6776895930592398094 + 6: 1 + 8 { + 1: "live_room_enter_toast" + 2: "{0:user} \346\235\245\344\272\206{1:string}" + 3 { + 1: "#de000000" + 4: 400 + } + 4 { + 1: 11 + 2 { + 1: "#61000000" + 4: 400 + } + 21 { + 1 { + 1: 50909397248 + 3: "\347\214\223\347\214\223\347\214\223\345\255\220" + 4: 1 + 9 { + 1: "http://p1.pstatp.com/thumb/96b002412f02c3d2735" + 2: "96b002412f02c3d2735" + } + 21 { + 1: "http://p3-webcast-ttcdn.byteimg.com/img/webcast/xigua_paygrade_level_5.png~tplv-obj.png" + 1: "http://p6-webcast-ttcdn.byteimg.com/img/webcast/xigua_paygrade_level_5.png~tplv-obj.png" + 1: "http://p1-webcast-ttcdn.byteimg.com/img/webcast/xigua_paygrade_level_5.png~tplv-obj.png" + 2: "webcast/xigua_paygrade_level_5.png" + 3: 16 + 4: 30 + 6: 1 + 7: "sslocal://webcast_webview?url=https%3A%2F%2Fwebcast.ixigua.com%2Ffalcon%2Fwebcast_xigua%2Fpage%2FhonorLevel%2Findex.html&type=popup&gravity=bottom&height=400&radius=8&__live_platform__=webcast" + } + 22 { + 1: 24 + 2: 1 + } + 23 { + 6: 5 + 19 { + 1: "http://p3-webcast-ttcdn.byteimg.com/img/webcast/xigua_paygrade_level_5.png~tplv-obj.png" + 1: "http://p6-webcast-ttcdn.byteimg.com/img/webcast/xigua_paygrade_level_5.png~tplv-obj.png" + 1: "http://p1-webcast-ttcdn.byteimg.com/img/webcast/xigua_paygrade_level_5.png~tplv-obj.png" + 2: "webcast/xigua_paygrade_level_5.png" + 3: 16 + 4: 30 + 6: 1 + 7: "sslocal://webcast_webview?url=https%3A%2F%2Fwebcast.ixigua.com%2Ffalcon%2Fwebcast_xigua%2Fpage%2FhonorLevel%2Findex.html&type=popup&gravity=bottom&height=400&radius=8&__live_platform__=webcast" + } + } + 24 { + 1 { + 4 { + 1 { + 1: 0 + 2: "" + } + } + } + } + 32: "" + 38: "0" + 46: "MS4wLjABAAAAwlVH0meNefJYE9l5cBWj5vZX8ooB9bII44Cf2CRXp9s" + } + } + } + } + } + 2 { + 1: 50909397248 + 3: "\347\214\223\347\214\223\347\214\223\345\255\220" + 4: 1 + 9 { + 1: "http://p1.pstatp.com/thumb/96b002412f02c3d2735" + 2: "96b002412f02c3d2735" + } + 21 { + 1: "http://p3-webcast-ttcdn.byteimg.com/img/webcast/xigua_paygrade_level_5.png~tplv-obj.png" + 1: "http://p6-webcast-ttcdn.byteimg.com/img/webcast/xigua_paygrade_level_5.png~tplv-obj.png" + 1: "http://p1-webcast-ttcdn.byteimg.com/img/webcast/xigua_paygrade_level_5.png~tplv-obj.png" + 2: "webcast/xigua_paygrade_level_5.png" + 3: 16 + 4: 30 + 6: 1 + 7: "sslocal://webcast_webview?url=https%3A%2F%2Fwebcast.ixigua.com%2Ffalcon%2Fwebcast_xigua%2Fpage%2FhonorLevel%2Findex.html&type=popup&gravity=bottom&height=400&radius=8&__live_platform__=webcast" + } + 22 { + 1: 24 + 2: 1 + } + 23 { + 6: 5 + 19 { + 1: "http://p3-webcast-ttcdn.byteimg.com/img/webcast/xigua_paygrade_level_5.png~tplv-obj.png" + 1: "http://p6-webcast-ttcdn.byteimg.com/img/webcast/xigua_paygrade_level_5.png~tplv-obj.png" + 1: "http://p1-webcast-ttcdn.byteimg.com/img/webcast/xigua_paygrade_level_5.png~tplv-obj.png" + 2: "webcast/xigua_paygrade_level_5.png" + 3: 16 + 4: 30 + 6: 1 + 7: "sslocal://webcast_webview?url=https%3A%2F%2Fwebcast.ixigua.com%2Ffalcon%2Fwebcast_xigua%2Fpage%2FhonorLevel%2Findex.html&type=popup&gravity=bottom&height=400&radius=8&__live_platform__=webcast" + } + } + 24 { + 1 { + 4 { + 1 { + 1: 0 + 2: "" + } + } + } + } + 32: "" + 38: "0" + 46: "MS4wLjABAAAAwlVH0meNefJYE9l5cBWj5vZX8ooB9bII44Cf2CRXp9s" + } + 3: 15103 + 10: 1 + 14: "132\344\270\207\344\272\272\346\260\224" + } +} +1 { + 1: "WebcastRoomUserSeqMessage" + 2 { + 1 { + 1: "WebcastRoomUserSeqMessage" + 2: 6776965783814933256 + 3: 6776895930592398094 + 4: 1577885306057 + } + 2 { + 1: 2997 + 2 { + 1: 92747501043 + 2: 517409 + 9 { + 1: "http://sf3-ttcdn-tos.pstatp.com/img/mosaic-legacy/feaa00016eaa01bf172e~120x256.image" + } + 23: "" + } + 3: 1 + } + 2 { + 1: 2198 + 2 { + 1: 1182693581391939 + 9 { + 1: "http://sf1-ttcdn-tos.pstatp.com/img/mosaic-legacy/dae10014972e8d70953e~120x256.image" + } + 23: "" + } + 3: 2 + } + 2 { + 1: 1998 + 2 { + 1: 5981054057 + 9 { + 1: "http://sf1-ttcdn-tos.pstatp.com/img/mosaic-legacy/75660014ae3215bae055~120x256.image" + } + 23: "" + } + 3: 3 + } + 2 { + 1: 1099 + 2 { + 1: 3836408254 + 9 { + 1: "http://sf1-ttcdn-tos.pstatp.com/img/mosaic-legacy/6620/5484795979~120x256.image" + } + 23: "" + } + 3: 4 + } + 2 { + 1: 999 + 2 { + 1: 830872766922279 + 9 { + 1: "http://sf1-ttcdn-tos.pstatp.com/img/tos-cn-i-0022/5a67caf5ae404432aa0524c33001241c~120x256.image" + } + 23: "" + } + 3: 5 + } + 2 { + 1: 999 + 2 { + 1: 7185332641 + 9 { + 1: "http://sf6-ttcdn-tos.pstatp.com/img/tos-cn-i-0022/754e3527d08540089a3adf6495845240~120x256.image" + } + 23: "" + } + 3: 6 + } + 2 { + 1: 520 + 2 { + 1: 93127918477 + 9 { + 1: "http://sf6-ttcdn-tos.pstatp.com/img/mosaic-legacy/3795/3044413937~120x256.image" + } + 23: "" + } + 3: 7 + } + 2 { + 1: 520 + 2 { + 1: 50073154686 + 9 { + 1: "http://p1-xg.bytecdn.cn/thumb/da790015e9c75441ff34" + 2: "da790015e9c75441ff34" + } + 23: "" + } + 3: 8 + } + 2 { + 1: 520 + 2 { + 1: 104620584571 + 9 { + 1: "http://sf6-ttcdn-tos.pstatp.com/img/mosaic-legacy/daa30018abcde9559b55~120x256.image" + } + 23: "" + } + 3: 9 + } + 2 { + 1: 120 + 2 { + 1: 5994520551 + 9 { + 1: "http://p1-xg.bytecdn.cn/thumb/aae5000ffc17e4f1f5da" + 2: "aae5000ffc17e4f1f5da" + } + 23: "" + } + 3: 10 + } + 2 { + 1: 100 + 2 { + 1: 54883854814 + 9 { + 1: "http://sf1-ttcdn-tos.pstatp.com/img/mosaic-legacy/da68001693847d505008~120x256.image" + } + 23: "" + } + 3: 11 + } + 2 { + 1: 99 + 2 { + 1: 82020236564 + 9 { + 1: "http://sf1-ttcdn-tos.pstatp.com/img/mosaic-legacy/5042000ff6673790f6d2~120x256.image" + } + 23: "" + } + 3: 12 + } + 2 { + 1: 66 + 2 { + 1: 3688188102 + 9 { + 1: "http://sf3-ttcdn-tos.pstatp.com/img/mosaic-legacy/e590005f1b8bdbd812c~120x256.image" + } + 23: "" + } + 3: 13 + } + 2 { + 1: 38 + 2 { + 1: 75972230499 + 9 { + 1: "http://sf1-ttcdn-tos.pstatp.com/img/mosaic-legacy/173b400272ba1269fb7d8~120x256.image" + } + 23: "" + } + 3: 14 + } + 2 { + 1: 20 + 2 { + 1: 654947037492940 + 9 { + 1: "http://sf3-ttcdn-tos.pstatp.com/img/mosaic-legacy/2e549000299b4f464f99f~120x256.image" + } + 23: "" + } + 3: 15 + } + 2 { + 1: 17 + 2 { + 1: 6896749077 + 9 { + 1: "http://sf1-ttcdn-tos.pstatp.com/img/mosaic-legacy/5046000873dbc5a8f31f~120x256.image" + } + 23: "" + } + 3: 16 + } + 2 { + 1: 14 + 2 { + 1: 50569473736 + 9 { + 1: "http://p3-xg.bytecdn.cn/thumb/5d4b0002a7134afffa47" + 2: "5d4b0002a7134afffa47" + } + 23: "" + } + 3: 17 + } + 2 { + 1: 14 + 2 { + 1: 2581241782866604 + 9 { + 1: "http://sf1-ttcdn-tos.pstatp.com/img/tos-cn-i-0022/51c85ec9c5754938b89504217ae5bbbc~120x256.image" + } + 23: "" + } + 3: 18 + } + 2 { + 1: 13 + 2 { + 1: 50651928991 + 9 { + 1: "http://sf6-ttcdn-tos.pstatp.com/img/tos-cn-i-0022/f81fee15e94a4405acc921916bfaff09~120x256.image" + } + 23: "" + } + 3: 19 + } + 2 { + 1: 11 + 2 { + 1: 106001804992 + 9 { + 1: "http://sf6-ttcdn-tos.pstatp.com/img/mosaic-legacy/fe5f000080632ba520f5~120x256.image" + } + 23: "" + } + 3: 20 + } + 3: 15094 + 4: "132\344\270\207\344\272\272\346\260\224" + 6: 1329944 + } +} +1 { + 1: "WebcastChatMessage" + 2 { + 1 { + 1: "WebcastChatMessage" + 2: 6776965784796482315 + 3: 6776895930592398094 + 4: 1577885306078 + 6: 1 + } + 2 { + 1: 52120728008 + 3: "\346\234\250\345\255\2202910" + 4: 1 + 9 { + 1: "http://p1.pstatp.com/thumb/ef6000df19086df2853" + 2: "ef6000df19086df2853" + } + 21 { + 1: "http://p3-webcast-ttcdn.byteimg.com/img/webcast/xigua_paygrade_level_3.png~tplv-obj.png" + 1: "http://p6-webcast-ttcdn.byteimg.com/img/webcast/xigua_paygrade_level_3.png~tplv-obj.png" + 1: "http://p1-webcast-ttcdn.byteimg.com/img/webcast/xigua_paygrade_level_3.png~tplv-obj.png" + 2: "webcast/xigua_paygrade_level_3.png" + 3: 16 + 4: 30 + 6: 1 + 7: "sslocal://webcast_webview?url=https%3A%2F%2Fwebcast.ixigua.com%2Ffalcon%2Fwebcast_xigua%2Fpage%2FhonorLevel%2Findex.html&__live_platform__=webcast&type=popup&gravity=bottom&height=400&radius=8" + } + 22 { + 1: 65 + 2: 16 + } + 23 { + 6: 3 + 19 { + 1: "http://p3-webcast-ttcdn.byteimg.com/img/webcast/xigua_paygrade_level_3.png~tplv-obj.png" + 1: "http://p6-webcast-ttcdn.byteimg.com/img/webcast/xigua_paygrade_level_3.png~tplv-obj.png" + 1: "http://p1-webcast-ttcdn.byteimg.com/img/webcast/xigua_paygrade_level_3.png~tplv-obj.png" + 2: "webcast/xigua_paygrade_level_3.png" + 3: 16 + 4: 30 + 6: 1 + 7: "sslocal://webcast_webview?url=https%3A%2F%2Fwebcast.ixigua.com%2Ffalcon%2Fwebcast_xigua%2Fpage%2FhonorLevel%2Findex.html&__live_platform__=webcast&type=popup&gravity=bottom&height=400&radius=8" + } + } + 24 { + 1 { + 4 { + 1 { + 1: 0 + 2: "" + } + } + } + } + 32: "" + 38: "0" + 46: "MS4wLjABAAAAD4OSjJ5hRbYDzZI0GJT_usTlLPEBYFrtPEYzBwLiIzQ" + 50 { + 1 { + 3: 1008 + 4: 1125 + } + 3 { + 3: 105 + 4: 111 + 7: "sslocal://webcast_webview?url=https%3A%2F%2Fwebcast.ixigua.com%2Ffalcon%2Fwebcast_xigua%2Fpage%2Fnoble%2Fnoble_privilege_intro%2Findex.html%3Fforbid_right_back%3D1&type=fullscreen&hide_nav_bar=1&status_bar_color=white&status_bar_bg_color=%2300000000&noble_intercept=1&__live_platform__=webcast" + } + 4: "\346\231\256\351\200\232\347\224\250\346\210\267" + 6 { + 3: 366 + 4: 615 + } + 7 { + 3: 60 + 4: 108 + } + 8 { + 1: "http://p1-webcast-ttcdn.byteimg.com/img/webcast/noble_boarder.png~tplv-obj.image" + 1: "http://p3-webcast-ttcdn.byteimg.com/img/webcast/noble_boarder.png~tplv-obj.image" + 1: "http://p9-webcast-ttcdn.byteimg.com/img/webcast/noble_boarder.png~tplv-obj.image" + 2: "webcast/noble_boarder.png" + 3: 64 + 4: 64 + } + } + } + 3: "\350\277\231\346\230\257\345\267\247\345\205\213\345\212\233\345\270\275\345\255\220\357\274\237" + } +} +1 { + 1: "WebcastMemberMessage" + 2 { + 1 { + 1: "WebcastMemberMessage" + 2: 6776965784520887054 + 3: 6776895930592398094 + 6: 1 + 8 { + 1: "live_room_enter_toast" + 2: "{0:user} \346\235\245\344\272\206{1:string}" + 3 { + 1: "#de000000" + 4: 400 + } + 4 { + 1: 11 + 2 { + 1: "#61000000" + 4: 400 + } + 21 { + 1 { + 1: 71581494772 + 3: "\345\217\253\346\210\221\350\221\211\345\220\214\345\255\246" + 4: 1 + 9 { + 1: "http://sf3-ttcdn-tos.pstatp.com/img/mosaic-legacy/3792/5112637127~120x256.image" + } + 22 { + 1: 6 + } + 23 { + 19: "" + } + 24 { + 1 { + 4 { + 1 { + 1: 0 + 2: "" + } + } + } + } + 32: "" + 38: "0" + 46: "MS4wLjABAAAAfgxQATVlN1REs0ezLccSYBNp34sVcfh3EZHMu5Fi8uE" + } + } + } + } + } + 2 { + 1: 71581494772 + 3: "\345\217\253\346\210\221\350\221\211\345\220\214\345\255\246" + 4: 1 + 9 { + 1: "http://sf3-ttcdn-tos.pstatp.com/img/mosaic-legacy/3792/5112637127~120x256.image" + } + 22 { + 1: 6 + } + 23 { + 19: "" + } + 24 { + 1 { + 4 { + 1 { + 1: 0 + 2: "" + } + } + } + } + 32: "" + 38: "0" + 46: "MS4wLjABAAAAfgxQATVlN1REs0ezLccSYBNp34sVcfh3EZHMu5Fi8uE" + } + 3: 15103 + 10: 1 + 14: "132\344\270\207\344\272\272\346\260\224" + } +} +1 { + 1: "WebcastMemberMessage" + 2 { + 1 { + 1: "WebcastMemberMessage" + 2: 6776965785094048520 + 3: 6776895930592398094 + 6: 1 + 8 { + 1: "live_room_enter_toast" + 2: "{0:user} \346\235\245\344\272\206{1:string}" + 3 { + 1: "#de000000" + 4: 400 + } + 4 { + 1: 11 + 2 { + 1: "#61000000" + 4: 400 + } + 21 { + 1 { + 1: 6205145196 + 3: "\346\210\221\344\270\215\346\230\257\350\200\201\351\211\204" + 4: 1 + 9 { + 1: "http://p1-xg.bytecdn.cn/thumb/249a001395445a62671d" + 2: "249a001395445a62671d" + } + 21 { + 1: "http://p6-webcast-xgcdn.byteimg.com/img/webcast/xigua_paygrade_level_8.png~tplv-obj.png" + 1: "http://p9-webcast-xgcdn.byteimg.com/img/webcast/xigua_paygrade_level_8.png~tplv-obj.png" + 1: "http://p3-webcast-xgcdn.byteimg.com/img/webcast/xigua_paygrade_level_8.png~tplv-obj.png" + 2: "webcast/xigua_paygrade_level_8.png" + 3: 16 + 4: 30 + 6: 1 + 7: "sslocal://webcast_webview?url=https%3A%2F%2Fwebcast.ixigua.com%2Ffalcon%2Fwebcast_xigua%2Fpage%2FhonorLevel%2Findex.html&type=popup&gravity=bottom&height=400&radius=8&__live_platform__=webcast" + } + 21 { + 1: "http://p9-webcast-xgcdn.byteimg.com/img/webcast/xigua_fansclub_medal_14.png~tplv-obj.image" + 1: "http://p1-webcast-xgcdn.byteimg.com/img/webcast/xigua_fansclub_medal_14.png~tplv-obj.image" + 1: "http://p6-webcast-xgcdn.byteimg.com/img/webcast/xigua_fansclub_medal_14.png~tplv-obj.image" + 2: "webcast/xigua_fansclub_medal_14.png" + 6: 7 + 8 { + 1: "\345\270\203\344\270\200\347\217\255" + 2: "#FFFFFF" + 3: 14 + } + } + 22 { + 1: 15 + 2: 54 + } + 23 { + 6: 8 + 19 { + 1: "http://p6-webcast-xgcdn.byteimg.com/img/webcast/xigua_paygrade_level_8.png~tplv-obj.png" + 1: "http://p9-webcast-xgcdn.byteimg.com/img/webcast/xigua_paygrade_level_8.png~tplv-obj.png" + 1: "http://p3-webcast-xgcdn.byteimg.com/img/webcast/xigua_paygrade_level_8.png~tplv-obj.png" + 2: "webcast/xigua_paygrade_level_8.png" + 3: 16 + 4: 30 + 6: 1 + 7: "sslocal://webcast_webview?url=https%3A%2F%2Fwebcast.ixigua.com%2Ffalcon%2Fwebcast_xigua%2Fpage%2FhonorLevel%2Findex.html&type=popup&gravity=bottom&height=400&radius=8&__live_platform__=webcast" + } + } + 24 { + 1 { + 1: "\345\270\203\344\270\200\347\217\255" + 2: 14 + 3: 1 + 4 { + 1 { + 1: 2 + 2 { + 1: "http://p9-webcast-xgcdn.byteimg.com/img/webcast/xigua_fansclub_medal_14.png~tplv-obj.image" + 1: "http://p1-webcast-xgcdn.byteimg.com/img/webcast/xigua_fansclub_medal_14.png~tplv-obj.image" + 1: "http://p6-webcast-xgcdn.byteimg.com/img/webcast/xigua_fansclub_medal_14.png~tplv-obj.image" + 2: "webcast/xigua_fansclub_medal_14.png" + 3: 48 + 4: 150 + } + } + 2: "\345\270\203\344\270\200\347\217\255" + } + } + } + 32: "" + 38: "0" + 46: "MS4wLjABAAAAGMn5pO7qE_ZZu6ETuJmfSW8KLhLOtRkLnr3IiLE2e6A" + } + } + } + } + } + 2 { + 1: 6205145196 + 3: "\346\210\221\344\270\215\346\230\257\350\200\201\351\211\204" + 4: 1 + 9 { + 1: "http://p1-xg.bytecdn.cn/thumb/249a001395445a62671d" + 2: "249a001395445a62671d" + } + 21 { + 1: "http://p6-webcast-xgcdn.byteimg.com/img/webcast/xigua_paygrade_level_8.png~tplv-obj.png" + 1: "http://p9-webcast-xgcdn.byteimg.com/img/webcast/xigua_paygrade_level_8.png~tplv-obj.png" + 1: "http://p3-webcast-xgcdn.byteimg.com/img/webcast/xigua_paygrade_level_8.png~tplv-obj.png" + 2: "webcast/xigua_paygrade_level_8.png" + 3: 16 + 4: 30 + 6: 1 + 7: "sslocal://webcast_webview?url=https%3A%2F%2Fwebcast.ixigua.com%2Ffalcon%2Fwebcast_xigua%2Fpage%2FhonorLevel%2Findex.html&type=popup&gravity=bottom&height=400&radius=8&__live_platform__=webcast" + } + 21 { + 1: "http://p9-webcast-xgcdn.byteimg.com/img/webcast/xigua_fansclub_medal_14.png~tplv-obj.image" + 1: "http://p1-webcast-xgcdn.byteimg.com/img/webcast/xigua_fansclub_medal_14.png~tplv-obj.image" + 1: "http://p6-webcast-xgcdn.byteimg.com/img/webcast/xigua_fansclub_medal_14.png~tplv-obj.image" + 2: "webcast/xigua_fansclub_medal_14.png" + 6: 7 + 8 { + 1: "\345\270\203\344\270\200\347\217\255" + 2: "#FFFFFF" + 3: 14 + } + } + 22 { + 1: 15 + 2: 54 + } + 23 { + 6: 8 + 19 { + 1: "http://p6-webcast-xgcdn.byteimg.com/img/webcast/xigua_paygrade_level_8.png~tplv-obj.png" + 1: "http://p9-webcast-xgcdn.byteimg.com/img/webcast/xigua_paygrade_level_8.png~tplv-obj.png" + 1: "http://p3-webcast-xgcdn.byteimg.com/img/webcast/xigua_paygrade_level_8.png~tplv-obj.png" + 2: "webcast/xigua_paygrade_level_8.png" + 3: 16 + 4: 30 + 6: 1 + 7: "sslocal://webcast_webview?url=https%3A%2F%2Fwebcast.ixigua.com%2Ffalcon%2Fwebcast_xigua%2Fpage%2FhonorLevel%2Findex.html&type=popup&gravity=bottom&height=400&radius=8&__live_platform__=webcast" + } + } + 24 { + 1 { + 1: "\345\270\203\344\270\200\347\217\255" + 2: 14 + 3: 1 + 4 { + 1 { + 1: 2 + 2 { + 1: "http://p9-webcast-xgcdn.byteimg.com/img/webcast/xigua_fansclub_medal_14.png~tplv-obj.image" + 1: "http://p1-webcast-xgcdn.byteimg.com/img/webcast/xigua_fansclub_medal_14.png~tplv-obj.image" + 1: "http://p6-webcast-xgcdn.byteimg.com/img/webcast/xigua_fansclub_medal_14.png~tplv-obj.image" + 2: "webcast/xigua_fansclub_medal_14.png" + 3: 48 + 4: 150 + } + } + 2: "\345\270\203\344\270\200\347\217\255" + } + } + } + 32: "" + 38: "0" + 46: "MS4wLjABAAAAGMn5pO7qE_ZZu6ETuJmfSW8KLhLOtRkLnr3IiLE2e6A" + } + 3: 15103 + 10: 1 + 14: "132\344\270\207\344\272\272\346\260\224" + } +} +1 { + 1: "WebcastFansclubStatisticsMessage" + 2 { + 1 { + 1: "WebcastFansclubStatisticsMessage" + 2: 6776950071441869579 + 3: 6776895930592398094 + 4: 1577885306430 + 6: 1 + } + 2: "\345\270\203\344\270\200\347\217\255" + 3: 19325 + } +} +1 { + 1: "WebcastFansclubMessage" + 2 { + 1 { + 1: "WebcastFansclubMessage" + 2: 6776950071441885963 + 3: 6776895930592398094 + 4: 1577885306441 + 6: 1 + } + 2: 2 + 3: "\346\201\255\345\226\234 \347\210\261\345\220\203\351\261\274\347\232\204\347\213\256\345\255\220\351\270\255 \346\210\220\344\270\272\347\254\25419325\345\220\215\347\262\211\344\270\235\345\233\242\346\210\220\345\221\230" + 4 { + 1: 109556646111 + 3: "\347\210\261\345\220\203\351\261\274\347\232\204\347\213\256\345\255\220\351\270\255" + 9 { + 1: "http://sf1-ttcdn-tos.pstatp.com/img/tos-cn-i-0022/66d462f176c841a0a4939ad355fe8c00~120x256.image" + } + 24 { + 1 { + 1: "\345\270\203\344\270\200\347\217\255" + 2: 1 + 3: 1 + 4 { + 1 { + 1: 2 + 2 { + 1: "https://p1.pstatp.com/obj/webcast/xigua_fansclub_1.png" + 2: "webcast/xigua_fansclub_1.png" + 3: 48 + 4: 150 + } + } + 2: "\345\270\203\344\270\200\347\217\255" + } + } + } + } + } +} +2: "6776950071441885963_1577885306619_6776965731513060100_1" +3: 1000 +4: 1577885306619 +5: "fetch_time:1577885306619|start_time:1577885302380|fetch_id:6776965761064883715|flag:0|seq:387" diff --git a/Struct/Chat.py b/Struct/Chat.py index 31269c6..b226dce 100644 --- a/Struct/Chat.py +++ b/Struct/Chat.py @@ -1,19 +1,29 @@ from .User import User from .Lottery import Lottery - +from XiguaMessage_pb2 import ChatMessage class Chat: - - content ="" - user=None - filterString = ["",] + content = "" + user = None + filterString = ["", ] isFiltered = False - def __init__(self, json=None, lottery:Lottery = None): - if json: - self.parse(json) + def __init__(self, json=None, lottery: Lottery = None): if lottery: self.filterString.append(lottery.content) + if json: + if type(json) == bytes: + self.parsePb(json) + else: + self.parse(json) + + def parsePb(self, raw): + _message = ChatMessage() + _message.ParseFromString(raw) + self.user = User(_message.user) + self.content = _message.content + if self.content in self.filterString: + self.isFiltered = True def parse(self, json): self.user = User(json) @@ -24,8 +34,7 @@ class Chat: self.isFiltered = True def __str__(self): - return "{} : {}".format(self.user,self.content) + return "{} : {}".format(self.user, self.content) def __unicode__(self): return self.__str__() - diff --git a/Struct/Gift.py b/Struct/Gift.py index b7f8e33..622cd72 100644 --- a/Struct/Gift.py +++ b/Struct/Gift.py @@ -1,5 +1,6 @@ import requests from .User import User +from XiguaMessage_pb2 import GiftMessage class Gift: @@ -11,9 +12,22 @@ class Gift: self.count = 0 self.amount = 0 self.user = None + self.isFinished = False self.backupName = None if json: - self.parse(json) + if type(json) == bytes: + self.parsePb(json) + else: + self.parse(json) + + def parsePb(self, raw): + _message = GiftMessage() + _message.ParseFromString(raw) + self.user = User(_message.user) + self.ID = _message.giftId + self.count = _message.combo + self.isFinished = _message.isFinished + self.backupName = _message.commonInfo.displayText.params.gifts.gift.name def parse(self, json): self.user = User(json) diff --git a/Struct/User.py b/Struct/User.py index 87c2c42..c01b722 100644 --- a/Struct/User.py +++ b/Struct/User.py @@ -1,15 +1,33 @@ -class User: - ID = 0 - name = "" - brand = "" - level = 0 - type = 0 - block = False - mute = False +from XiguaUser_pb2 import User as UserPb + +class User: def __init__(self, json=None): + self.ID = 0 + self.name = "" + self.brand = "" + self.level = 0 + self.type = 0 + self.block = False + self.mute = False if json: - self.parse(json) + if type(json) == bytes: + self.parsePb(json) + elif type(json) == UserPb: + self.parseUserPb(json) + else: + self.parse(json) + + def parseUserPb(self, _user): + self.ID = _user.id + self.name = _user.nickname + self.brand = _user.fansClub.fansClub.title + self.level = _user.fansClub.fansClub.level + + def parsePb(self, raw): + _user = UserPb() + _user.ParseFromString(raw) + self.parseUserPb(_user) def parse(self, json): if "extra" in json: diff --git a/XiguaMessage_pb2.py b/XiguaMessage_pb2.py index 6b7f8f8..58c5dc8 100644 --- a/XiguaMessage_pb2.py +++ b/XiguaMessage_pb2.py @@ -20,7 +20,7 @@ DESCRIPTOR = _descriptor.FileDescriptor( package='', syntax='proto2', serialized_options=None, - serialized_pb=b'\n\x12XiguaMessage.proto\x1a\x0fXiguaUser.proto\x1a\x0fXiguaGift.proto\"`\n\x07Message\x12\x1f\n\ncommonInfo\x18\x01 \x02(\x0b\x32\x0b.CommonInfo\x12\x10\n\x08\x63ontent2\x18\x02 \x02(\x0c\x12\x10\n\x08\x63ontent3\x18\x03 \x02(\x0c\x12\x10\n\x08\x63ontent4\x18\x04 \x02(\x0c\"k\n\x0f\x46\x61nsClubMessage\x12\x1f\n\ncommonInfo\x18\x01 \x02(\x0b\x32\x0b.CommonInfo\x12\x10\n\x08someEnum\x18\x02 \x02(\x05\x12\x10\n\x08someInt3\x18\x03 \x02(\x05\x12\x13\n\x04user\x18\x04 \x02(\x0b\x32\x05.User\"]\n\x0eUserSeqMessage\x12\x1f\n\ncommonInfo\x18\x01 \x02(\x0b\x32\x0b.CommonInfo\x12\x16\n\x0epopularityText\x18\x04 \x02(\t\x12\x12\n\npopularity\x18\x06 \x02(\x05\"D\n\x10\x44\x61ilyRankMessage\x12\x1f\n\ncommonInfo\x18\x01 \x02(\x0b\x32\x0b.CommonInfo\x12\x0f\n\x07ranking\x18\n \x02(\x05\"T\n\x0b\x43hatMessage\x12\x1f\n\ncommonInfo\x18\x01 \x02(\x0b\x32\x0b.CommonInfo\x12\x13\n\x04user\x18\x02 \x02(\x0b\x32\x05.User\x12\x0f\n\x07\x63ontent\x18\x03 \x02(\t\"]\n\rMemberMessage\x12\x1f\n\ncommonInfo\x18\x01 \x02(\x0b\x32\x0b.CommonInfo\x12\x13\n\x04user\x18\x02 \x02(\x0b\x32\x05.User\x12\x16\n\x0epopularityText\x18\x0e \x02(\t\"\xa1\x01\n\x0bGiftMessage\x12\x1f\n\ncommonInfo\x18\x01 \x02(\x0b\x32\x0b.CommonInfo\x12\x0e\n\x06giftId\x18\x02 \x02(\x05\x12\x10\n\x08\x63ontent4\x18\x04 \x02(\x05\x12\x10\n\x08repeated\x18\x05 \x02(\x05\x12\r\n\x05\x63ombo\x18\x06 \x02(\x05\x12\x13\n\x04user\x18\x07 \x02(\x0b\x32\x05.User\x12\x19\n\nisFinished\x18\t \x01(\x08:\x05\x66\x61lse\"*\n\x05Style\x12\r\n\x05\x63olor\x18\x01 \x01(\t\x12\x12\n\nfontWeight\x18\x04 \x01(\x05\"q\n\x06Params\x12\x0c\n\x04type\x18\x01 \x02(\x05\x12\x15\n\x05style\x18\x02 \x01(\x0b\x32\x06.Style\x12\x0e\n\x06string\x18\x0b \x01(\t\x12\x18\n\x05users\x18\x15 \x01(\x0b\x32\t.UserPack\x12\x18\n\x05gifts\x18\x16 \x01(\x0b\x32\t.GiftPack\"_\n\x0b\x44isplayText\x12\x0e\n\x06method\x18\x01 \x02(\t\x12\x0e\n\x06\x66ormat\x18\x02 \x02(\t\x12\x17\n\x07\x62gStyle\x18\x03 \x01(\x0b\x32\x06.Style\x12\x17\n\x06params\x18\x04 \x02(\x0b\x32\x07.Params\"\x87\x01\n\nCommonInfo\x12\x0e\n\x06method\x18\x01 \x02(\t\x12\x0e\n\x06msg_id\x18\x02 \x02(\x05\x12\x0f\n\x07room_id\x18\x03 \x02(\x05\x12\x13\n\x0b\x63reate_time\x18\x04 \x02(\x05\x12\x10\n\x08someEnum\x18\x06 \x01(\x05\x12!\n\x0b\x64isplayText\x18\x08 \x01(\x0b\x32\x0c.DisplayText' + serialized_pb=b'\n\x12XiguaMessage.proto\x1a\x0fXiguaUser.proto\x1a\x0fXiguaGift.proto\"`\n\x07Message\x12\x1f\n\ncommonInfo\x18\x01 \x02(\x0b\x32\x0b.CommonInfo\x12\x10\n\x08\x63ontent2\x18\x02 \x02(\x0c\x12\x10\n\x08\x63ontent3\x18\x03 \x02(\x0c\x12\x10\n\x08\x63ontent4\x18\x04 \x02(\x0c\"f\n\x0f\x46\x61nsClubMessage\x12\x1f\n\ncommonInfo\x18\x01 \x02(\x0b\x32\x0b.CommonInfo\x12\x0c\n\x04type\x18\x02 \x02(\x05\x12\x0f\n\x07\x63ontent\x18\x03 \x02(\t\x12\x13\n\x04user\x18\x04 \x02(\x0b\x32\x05.User\"U\n\x14\x46\x61nsClubStatsMessage\x12\x1f\n\ncommonInfo\x18\x01 \x02(\x0b\x32\x0b.CommonInfo\x12\r\n\x05title\x18\x02 \x02(\t\x12\r\n\x05\x63ount\x18\x03 \x02(\x05\"]\n\x0eUserSeqMessage\x12\x1f\n\ncommonInfo\x18\x01 \x02(\x0b\x32\x0b.CommonInfo\x12\x16\n\x0epopularityText\x18\x04 \x02(\t\x12\x12\n\npopularity\x18\x06 \x02(\x05\"D\n\x10\x44\x61ilyRankMessage\x12\x1f\n\ncommonInfo\x18\x01 \x02(\x0b\x32\x0b.CommonInfo\x12\x0f\n\x07ranking\x18\n \x02(\x05\"T\n\x0b\x43hatMessage\x12\x1f\n\ncommonInfo\x18\x01 \x02(\x0b\x32\x0b.CommonInfo\x12\x13\n\x04user\x18\x02 \x02(\x0b\x32\x05.User\x12\x0f\n\x07\x63ontent\x18\x03 \x02(\t\"]\n\rMemberMessage\x12\x1f\n\ncommonInfo\x18\x01 \x02(\x0b\x32\x0b.CommonInfo\x12\x13\n\x04user\x18\x02 \x02(\x0b\x32\x05.User\x12\x16\n\x0epopularityText\x18\x0e \x02(\t\"\xa1\x01\n\x0bGiftMessage\x12\x1f\n\ncommonInfo\x18\x01 \x02(\x0b\x32\x0b.CommonInfo\x12\x0e\n\x06giftId\x18\x02 \x02(\x05\x12\x10\n\x08\x63ontent4\x18\x04 \x02(\x05\x12\x10\n\x08repeated\x18\x05 \x02(\x05\x12\r\n\x05\x63ombo\x18\x06 \x02(\x05\x12\x13\n\x04user\x18\x07 \x01(\x0b\x32\x05.User\x12\x19\n\nisFinished\x18\t \x01(\x08:\x05\x66\x61lse\"*\n\x05Style\x12\r\n\x05\x63olor\x18\x01 \x01(\t\x12\x12\n\nfontWeight\x18\x04 \x01(\x05\"q\n\x06Params\x12\x0c\n\x04type\x18\x01 \x02(\x05\x12\x15\n\x05style\x18\x02 \x01(\x0b\x32\x06.Style\x12\x0e\n\x06string\x18\x0b \x01(\t\x12\x18\n\x05users\x18\x15 \x01(\x0b\x32\t.UserPack\x12\x18\n\x05gifts\x18\x16 \x01(\x0b\x32\t.GiftPack\"_\n\x0b\x44isplayText\x12\x0e\n\x06method\x18\x01 \x02(\t\x12\x0e\n\x06\x66ormat\x18\x02 \x02(\t\x12\x17\n\x07\x62gStyle\x18\x03 \x01(\x0b\x32\x06.Style\x12\x17\n\x06params\x18\x04 \x02(\x0b\x32\x07.Params\"\x87\x01\n\nCommonInfo\x12\x0e\n\x06method\x18\x01 \x02(\t\x12\x0e\n\x06msg_id\x18\x02 \x02(\x05\x12\x0f\n\x07room_id\x18\x03 \x02(\x05\x12\x13\n\x0b\x63reate_time\x18\x04 \x02(\x05\x12\x10\n\x08someEnum\x18\x06 \x01(\x05\x12!\n\x0b\x64isplayText\x18\x08 \x01(\x0b\x32\x0c.DisplayText' , dependencies=[XiguaUser__pb2.DESCRIPTOR,XiguaGift__pb2.DESCRIPTOR,]) @@ -94,16 +94,16 @@ _FANSCLUBMESSAGE = _descriptor.Descriptor( is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( - name='someEnum', full_name='FansClubMessage.someEnum', index=1, + name='type', full_name='FansClubMessage.type', index=1, number=2, type=5, cpp_type=1, label=2, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( - name='someInt3', full_name='FansClubMessage.someInt3', index=2, - number=3, type=5, cpp_type=1, label=2, - has_default_value=False, default_value=0, + name='content', full_name='FansClubMessage.content', index=2, + number=3, type=9, cpp_type=9, label=2, + has_default_value=False, default_value=b"".decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), @@ -127,7 +127,52 @@ _FANSCLUBMESSAGE = _descriptor.Descriptor( oneofs=[ ], serialized_start=154, - serialized_end=261, + serialized_end=256, +) + + +_FANSCLUBSTATSMESSAGE = _descriptor.Descriptor( + name='FansClubStatsMessage', + full_name='FansClubStatsMessage', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='commonInfo', full_name='FansClubStatsMessage.commonInfo', index=0, + number=1, type=11, cpp_type=10, label=2, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='title', full_name='FansClubStatsMessage.title', index=1, + number=2, type=9, cpp_type=9, label=2, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='count', full_name='FansClubStatsMessage.count', index=2, + number=3, type=5, cpp_type=1, label=2, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=258, + serialized_end=343, ) @@ -171,8 +216,8 @@ _USERSEQMESSAGE = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=263, - serialized_end=356, + serialized_start=345, + serialized_end=438, ) @@ -209,8 +254,8 @@ _DAILYRANKMESSAGE = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=358, - serialized_end=426, + serialized_start=440, + serialized_end=508, ) @@ -254,8 +299,8 @@ _CHATMESSAGE = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=428, - serialized_end=512, + serialized_start=510, + serialized_end=594, ) @@ -299,8 +344,8 @@ _MEMBERMESSAGE = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=514, - serialized_end=607, + serialized_start=596, + serialized_end=689, ) @@ -348,7 +393,7 @@ _GIFTMESSAGE = _descriptor.Descriptor( serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='user', full_name='GiftMessage.user', index=5, - number=7, type=11, cpp_type=10, label=2, + number=7, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, @@ -372,8 +417,8 @@ _GIFTMESSAGE = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=610, - serialized_end=771, + serialized_start=692, + serialized_end=853, ) @@ -410,8 +455,8 @@ _STYLE = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=773, - serialized_end=815, + serialized_start=855, + serialized_end=897, ) @@ -469,8 +514,8 @@ _PARAMS = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=817, - serialized_end=930, + serialized_start=899, + serialized_end=1012, ) @@ -521,8 +566,8 @@ _DISPLAYTEXT = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=932, - serialized_end=1027, + serialized_start=1014, + serialized_end=1109, ) @@ -587,13 +632,14 @@ _COMMONINFO = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=1030, - serialized_end=1165, + serialized_start=1112, + serialized_end=1247, ) _MESSAGE.fields_by_name['commonInfo'].message_type = _COMMONINFO _FANSCLUBMESSAGE.fields_by_name['commonInfo'].message_type = _COMMONINFO _FANSCLUBMESSAGE.fields_by_name['user'].message_type = XiguaUser__pb2._USER +_FANSCLUBSTATSMESSAGE.fields_by_name['commonInfo'].message_type = _COMMONINFO _USERSEQMESSAGE.fields_by_name['commonInfo'].message_type = _COMMONINFO _DAILYRANKMESSAGE.fields_by_name['commonInfo'].message_type = _COMMONINFO _CHATMESSAGE.fields_by_name['commonInfo'].message_type = _COMMONINFO @@ -610,6 +656,7 @@ _DISPLAYTEXT.fields_by_name['params'].message_type = _PARAMS _COMMONINFO.fields_by_name['displayText'].message_type = _DISPLAYTEXT DESCRIPTOR.message_types_by_name['Message'] = _MESSAGE DESCRIPTOR.message_types_by_name['FansClubMessage'] = _FANSCLUBMESSAGE +DESCRIPTOR.message_types_by_name['FansClubStatsMessage'] = _FANSCLUBSTATSMESSAGE DESCRIPTOR.message_types_by_name['UserSeqMessage'] = _USERSEQMESSAGE DESCRIPTOR.message_types_by_name['DailyRankMessage'] = _DAILYRANKMESSAGE DESCRIPTOR.message_types_by_name['ChatMessage'] = _CHATMESSAGE @@ -635,6 +682,13 @@ FansClubMessage = _reflection.GeneratedProtocolMessageType('FansClubMessage', (_ }) _sym_db.RegisterMessage(FansClubMessage) +FansClubStatsMessage = _reflection.GeneratedProtocolMessageType('FansClubStatsMessage', (_message.Message,), { + 'DESCRIPTOR' : _FANSCLUBSTATSMESSAGE, + '__module__' : 'XiguaMessage_pb2' + # @@protoc_insertion_point(class_scope:FansClubStatsMessage) + }) +_sym_db.RegisterMessage(FansClubStatsMessage) + UserSeqMessage = _reflection.GeneratedProtocolMessageType('UserSeqMessage', (_message.Message,), { 'DESCRIPTOR' : _USERSEQMESSAGE, '__module__' : 'XiguaMessage_pb2' diff --git a/XiguaUser_pb2.py b/XiguaUser_pb2.py index c4ca08a..8c0a2f4 100644 --- a/XiguaUser_pb2.py +++ b/XiguaUser_pb2.py @@ -18,7 +18,7 @@ DESCRIPTOR = _descriptor.FileDescriptor( package='', syntax='proto2', serialized_options=None, - serialized_pb=b'\n\x0fXiguaUser.proto\"\x1f\n\x08UserPack\x12\x13\n\x04user\x18\x01 \x02(\x0b\x32\x05.User\"\xc8\x01\n\x05\x42\x61\x64ge\x12\x0b\n\x03url\x18\x01 \x03(\t\x12\x10\n\x08localUrl\x18\x02 \x01(\t\x12\x0e\n\x06height\x18\x03 \x01(\x05\x12\r\n\x05width\x18\x04 \x01(\x05\x12\x0c\n\x04type\x18\x06 \x01(\x05\x12\x0f\n\x07\x63lickTo\x18\x07 \x01(\t\x12\'\n\x0b\x66\x61nClubText\x18\x08 \x01(\x0b\x32\x12.Badge.FanClubText\x1a\x39\n\x0b\x46\x61nClubText\x12\x0c\n\x04text\x18\x01 \x02(\t\x12\r\n\x05\x63olor\x18\x02 \x01(\t\x12\r\n\x05level\x18\x03 \x02(\x05\";\n\x11\x46\x61nsClubBadgePack\x12\x15\n\x05\x62\x61\x64ge\x18\x01 \x02(\x0b\x32\x06.Badge\x12\x0f\n\x05title\x18\x02 \x01(\t:\x00\"\xa0\x01\n\x0c\x46\x61nsClubPack\x12(\n\x08\x66\x61nsClub\x18\x01 \x02(\x0b\x32\x16.FansClubPack.FansClub\x1a\x66\n\x08\x46\x61nsClub\x12\x0f\n\x05title\x18\x01 \x02(\t:\x00\x12\x10\n\x05level\x18\x02 \x02(\x05:\x01\x30\x12\x10\n\x08someEnum\x18\x03 \x01(\x05\x12%\n\tfansClubs\x18\x04 \x02(\x0b\x32\x12.FansClubBadgePack\"\xd8\x05\n\x04User\x12\n\n\x02id\x18\x01 \x02(\x03\x12\x10\n\x08nickname\x18\x03 \x02(\t\x12\x0e\n\x06gender\x18\x04 \x02(\x05\x12!\n\x0b\x61vatarThumb\x18\t \x02(\x0b\x32\x0c.User.Avatar\x12\"\n\x0c\x61vatarMedium\x18\n \x01(\x0b\x32\x0c.User.Avatar\x12!\n\x0b\x61vatarLarge\x18\x0b \x01(\x0b\x32\x0c.User.Avatar\x12\x15\n\x05\x62\x61\x64ge\x18\x15 \x03(\x0b\x32\x06.Badge\x12\x1c\n\x06\x66ollow\x18\x16 \x01(\x0b\x32\x0c.User.Follow\x12 \n\x08payGrade\x18\x17 \x02(\x0b\x32\x0e.User.PayGrade\x12\x1f\n\x08\x66\x61nsClub\x18\x18 \x02(\x0b\x32\r.FansClubPack\x12\x11\n\ttotalPaid\x18\" \x02(\x05\x1a!\n\x06\x41vatar\x12\x0b\n\x03url\x18\x01 \x02(\t\x12\n\n\x02id\x18\x02 \x01(\t\x1a\x33\n\x06\x46ollow\x12\x14\n\tfollowing\x18\x01 \x01(\x05:\x01\x30\x12\x13\n\x08\x66ollower\x18\x02 \x01(\x05:\x01\x30\x1a\x9c\x01\n\x08PayGrade\x12\x0f\n\x07\x63urrent\x18\x01 \x02(\x05\x12\r\n\x05level\x18\x06 \x02(\x05\x12\x18\n\x10\x63urrentLevelNeed\x18\n \x01(\x05\x12\x15\n\rnextLevelNeed\x18\x0b \x01(\x05\x12\x0f\n\x07\x63ontent\x18\r \x01(\t\x12\x15\n\x05\x62\x61\x64ge\x18\x13 \x02(\x0b\x32\x06.Badge\x12\x17\n\x0ftoNextLevelNeed\x18\x15 \x01(\x05\x1a#\n\nHonorLevel\x12\x15\n\x05\x62\x61\x64ge\x18\x13 \x02(\x0b\x32\x06.Badge\x1a\x90\x01\n\x05Noble\x12\x0f\n\x07\x63ontent\x18\x04 \x02(\t\x12)\n\x07\x62oarder\x18\x08 \x01(\x0b\x32\x18.User.Noble.NobleBoarder\x1aK\n\x0cNobleBoarder\x12\x0f\n\x07urlList\x18\x01 \x03(\t\x12\x0b\n\x03uri\x18\x02 \x02(\t\x12\x0e\n\x06height\x18\x03 \x01(\x05\x12\r\n\x05width\x18\x04 \x01(\x05' + serialized_pb=b'\n\x0fXiguaUser.proto\"\x1f\n\x08UserPack\x12\x13\n\x04user\x18\x01 \x02(\x0b\x32\x05.User\"\xb6\x01\n\x05\x42\x61\x64ge\x12\x0b\n\x03url\x18\x01 \x03(\t\x12\x0e\n\x06height\x18\x03 \x01(\x05\x12\r\n\x05width\x18\x04 \x01(\x05\x12\x0c\n\x04type\x18\x06 \x01(\x05\x12\x0f\n\x07\x63lickTo\x18\x07 \x01(\t\x12\'\n\x0b\x66\x61nClubText\x18\x08 \x01(\x0b\x32\x12.Badge.FanClubText\x1a\x39\n\x0b\x46\x61nClubText\x12\x0c\n\x04text\x18\x01 \x02(\t\x12\r\n\x05\x63olor\x18\x02 \x01(\t\x12\r\n\x05level\x18\x03 \x02(\x05\"y\n\x0c\x46\x61nsClubPack\x12(\n\x08\x66\x61nsClub\x18\x01 \x02(\x0b\x32\x16.FansClubPack.FansClub\x1a?\n\x08\x46\x61nsClub\x12\x0f\n\x05title\x18\x01 \x02(\t:\x00\x12\x10\n\x05level\x18\x02 \x02(\x05:\x01\x30\x12\x10\n\x08someEnum\x18\x03 \x01(\x05\"\xd8\x05\n\x04User\x12\n\n\x02id\x18\x01 \x02(\x03\x12\x10\n\x08nickname\x18\x03 \x02(\t\x12\x0e\n\x06gender\x18\x04 \x02(\x05\x12!\n\x0b\x61vatarThumb\x18\t \x02(\x0b\x32\x0c.User.Avatar\x12\"\n\x0c\x61vatarMedium\x18\n \x01(\x0b\x32\x0c.User.Avatar\x12!\n\x0b\x61vatarLarge\x18\x0b \x01(\x0b\x32\x0c.User.Avatar\x12\x15\n\x05\x62\x61\x64ge\x18\x15 \x03(\x0b\x32\x06.Badge\x12\x1c\n\x06\x66ollow\x18\x16 \x01(\x0b\x32\x0c.User.Follow\x12 \n\x08payGrade\x18\x17 \x02(\x0b\x32\x0e.User.PayGrade\x12\x1f\n\x08\x66\x61nsClub\x18\x18 \x02(\x0b\x32\r.FansClubPack\x12\x11\n\ttotalPaid\x18\" \x02(\x05\x1a!\n\x06\x41vatar\x12\x0b\n\x03url\x18\x01 \x02(\t\x12\n\n\x02id\x18\x02 \x01(\t\x1a\x33\n\x06\x46ollow\x12\x14\n\tfollowing\x18\x01 \x01(\x05:\x01\x30\x12\x13\n\x08\x66ollower\x18\x02 \x01(\x05:\x01\x30\x1a\x9c\x01\n\x08PayGrade\x12\x0f\n\x07\x63urrent\x18\x01 \x02(\x05\x12\r\n\x05level\x18\x06 \x02(\x05\x12\x18\n\x10\x63urrentLevelNeed\x18\n \x01(\x05\x12\x15\n\rnextLevelNeed\x18\x0b \x01(\x05\x12\x0f\n\x07\x63ontent\x18\r \x01(\t\x12\x15\n\x05\x62\x61\x64ge\x18\x13 \x02(\x0b\x32\x06.Badge\x12\x17\n\x0ftoNextLevelNeed\x18\x15 \x01(\x05\x1a#\n\nHonorLevel\x12\x15\n\x05\x62\x61\x64ge\x18\x13 \x02(\x0b\x32\x06.Badge\x1a\x90\x01\n\x05Noble\x12\x0f\n\x07\x63ontent\x18\x04 \x02(\t\x12)\n\x07\x62oarder\x18\x08 \x01(\x0b\x32\x18.User.Noble.NobleBoarder\x1aK\n\x0cNobleBoarder\x12\x0f\n\x07urlList\x18\x01 \x03(\t\x12\x0b\n\x03uri\x18\x02 \x02(\t\x12\x0e\n\x06height\x18\x03 \x01(\x05\x12\r\n\x05width\x18\x04 \x01(\x05' ) @@ -95,8 +95,8 @@ _BADGE_FANCLUBTEXT = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=196, - serialized_end=253, + serialized_start=178, + serialized_end=235, ) _BADGE = _descriptor.Descriptor( @@ -114,42 +114,35 @@ _BADGE = _descriptor.Descriptor( is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( - name='localUrl', full_name='Badge.localUrl', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='height', full_name='Badge.height', index=2, + name='height', full_name='Badge.height', index=1, number=3, type=5, cpp_type=1, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( - name='width', full_name='Badge.width', index=3, + name='width', full_name='Badge.width', index=2, number=4, type=5, cpp_type=1, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( - name='type', full_name='Badge.type', index=4, + name='type', full_name='Badge.type', index=3, number=6, type=5, cpp_type=1, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( - name='clickTo', full_name='Badge.clickTo', index=5, + name='clickTo', full_name='Badge.clickTo', index=4, number=7, type=9, cpp_type=9, label=1, has_default_value=False, default_value=b"".decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( - name='fanClubText', full_name='Badge.fanClubText', index=6, + name='fanClubText', full_name='Badge.fanClubText', index=5, number=8, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, @@ -168,45 +161,7 @@ _BADGE = _descriptor.Descriptor( oneofs=[ ], serialized_start=53, - serialized_end=253, -) - - -_FANSCLUBBADGEPACK = _descriptor.Descriptor( - name='FansClubBadgePack', - full_name='FansClubBadgePack', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='badge', full_name='FansClubBadgePack.badge', index=0, - number=1, type=11, cpp_type=10, label=2, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='title', full_name='FansClubBadgePack.title', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=True, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto2', - extension_ranges=[], - oneofs=[ - ], - serialized_start=255, - serialized_end=314, + serialized_end=235, ) @@ -238,13 +193,6 @@ _FANSCLUBPACK_FANSCLUB = _descriptor.Descriptor( message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='fansClubs', full_name='FansClubPack.FansClub.fansClubs', index=3, - number=4, type=11, cpp_type=10, label=2, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -257,8 +205,8 @@ _FANSCLUBPACK_FANSCLUB = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=375, - serialized_end=477, + serialized_start=295, + serialized_end=358, ) _FANSCLUBPACK = _descriptor.Descriptor( @@ -287,8 +235,8 @@ _FANSCLUBPACK = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=317, - serialized_end=477, + serialized_start=237, + serialized_end=358, ) @@ -325,8 +273,8 @@ _USER_AVATAR = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=779, - serialized_end=812, + serialized_start=660, + serialized_end=693, ) _USER_FOLLOW = _descriptor.Descriptor( @@ -362,8 +310,8 @@ _USER_FOLLOW = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=814, - serialized_end=865, + serialized_start=695, + serialized_end=746, ) _USER_PAYGRADE = _descriptor.Descriptor( @@ -434,8 +382,8 @@ _USER_PAYGRADE = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=868, - serialized_end=1024, + serialized_start=749, + serialized_end=905, ) _USER_HONORLEVEL = _descriptor.Descriptor( @@ -464,8 +412,8 @@ _USER_HONORLEVEL = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=1026, - serialized_end=1061, + serialized_start=907, + serialized_end=942, ) _USER_NOBLE_NOBLEBOARDER = _descriptor.Descriptor( @@ -515,8 +463,8 @@ _USER_NOBLE_NOBLEBOARDER = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=1133, - serialized_end=1208, + serialized_start=1014, + serialized_end=1089, ) _USER_NOBLE = _descriptor.Descriptor( @@ -552,8 +500,8 @@ _USER_NOBLE = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=1064, - serialized_end=1208, + serialized_start=945, + serialized_end=1089, ) _USER = _descriptor.Descriptor( @@ -652,15 +600,13 @@ _USER = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=480, - serialized_end=1208, + serialized_start=361, + serialized_end=1089, ) _USERPACK.fields_by_name['user'].message_type = _USER _BADGE_FANCLUBTEXT.containing_type = _BADGE _BADGE.fields_by_name['fanClubText'].message_type = _BADGE_FANCLUBTEXT -_FANSCLUBBADGEPACK.fields_by_name['badge'].message_type = _BADGE -_FANSCLUBPACK_FANSCLUB.fields_by_name['fansClubs'].message_type = _FANSCLUBBADGEPACK _FANSCLUBPACK_FANSCLUB.containing_type = _FANSCLUBPACK _FANSCLUBPACK.fields_by_name['fansClub'].message_type = _FANSCLUBPACK_FANSCLUB _USER_AVATAR.containing_type = _USER @@ -681,7 +627,6 @@ _USER.fields_by_name['payGrade'].message_type = _USER_PAYGRADE _USER.fields_by_name['fansClub'].message_type = _FANSCLUBPACK DESCRIPTOR.message_types_by_name['UserPack'] = _USERPACK DESCRIPTOR.message_types_by_name['Badge'] = _BADGE -DESCRIPTOR.message_types_by_name['FansClubBadgePack'] = _FANSCLUBBADGEPACK DESCRIPTOR.message_types_by_name['FansClubPack'] = _FANSCLUBPACK DESCRIPTOR.message_types_by_name['User'] = _USER _sym_db.RegisterFileDescriptor(DESCRIPTOR) @@ -708,13 +653,6 @@ Badge = _reflection.GeneratedProtocolMessageType('Badge', (_message.Message,), { _sym_db.RegisterMessage(Badge) _sym_db.RegisterMessage(Badge.FanClubText) -FansClubBadgePack = _reflection.GeneratedProtocolMessageType('FansClubBadgePack', (_message.Message,), { - 'DESCRIPTOR' : _FANSCLUBBADGEPACK, - '__module__' : 'XiguaUser_pb2' - # @@protoc_insertion_point(class_scope:FansClubBadgePack) - }) -_sym_db.RegisterMessage(FansClubBadgePack) - FansClubPack = _reflection.GeneratedProtocolMessageType('FansClubPack', (_message.Message,), { 'FansClub' : _reflection.GeneratedProtocolMessageType('FansClub', (_message.Message,), { diff --git a/api.py b/api.py index fb5d3f6..284538a 100644 --- a/api.py +++ b/api.py @@ -350,27 +350,18 @@ class XiGuaLiveApi: self._ext = data.internal_ext for _each in data.data: if _each.method == "WebcastGiftMessage": - _giftMessage = GiftMessage() - _giftMessage.ParseFromString(_each.raw) - _gift = Gift() - _gift.ID = _giftMessage.giftId - _gift.count = _giftMessage.combo - if _gift.isAnimate() or _giftMessage.isFinished: - _user = User() - _user.ID = _giftMessage.user.id - _user.name = _giftMessage.user.nickname - _gift.user = _user - _gift.backupName = _each.message.commonInfo.displayText.params.gifts.gift.name + _gift = Gift(_each.raw) + if _gift.isAnimate() or _gift.isFinished: self.onPresentEnd(_gift) + elif _each.method == "WebcastChatMessage": + _chat = Chat(_each.raw) + self.onChat(_chat) elif _each.method == "WebcastFansclubMessage": _fansClubMessage = FansClubMessage() _fansClubMessage.ParseFromString(_each.raw) - _user = User() - _user.id = _fansClubMessage.user.id - _user.name = _fansClubMessage.user.nickname - print(_fansClubMessage.someEnum) - print(_fansClubMessage.someInt3) - # self.onJoin(_user) + if _fansClubMessage.type == 2: + _user = User(_fansClubMessage.user) + self.onJoin(_user) else: pass # 更新抽奖信息 @@ -410,8 +401,8 @@ if __name__ == "__main__": except requests.exceptions.BaseHTTPError: print("网络错误,请确认网络") time.sleep(5) - except Exception as e: - print(e) + # except Exception as e: + # print(e) else: print("主播未开播,等待1分钟后重试") time.sleep(60)