Proto更新--心累

This commit is contained in:
Jerry Yan 2020-01-01 19:56:49 +08:00
parent 8f1893fdb1
commit ff53afffb5
10 changed files with 9378 additions and 118 deletions

View File

@ -18,8 +18,8 @@ message Params {
required int32 type = 1;
optional Style style = 2;
optional string string = 11;
optional User user = 21;
optional Gift gift = 22;
optional UserPack users = 21;
optional GiftPack gifts = 22;
}
//
message DisplayText {
@ -27,7 +27,7 @@ message DisplayText {
required string method = 1;
required string format = 2;
optional Style bgStyle = 3;
repeated Params params = 4;
required Params params = 4;
}
//
message CommonInfo {

View File

@ -1,10 +1,10 @@
syntax = "proto2";
//
message Gift {
message Detail {
required string gift_id = 1;
required string gift_name = 2;
}
required int32 id = 1;
required Detail gift = 2;
required string id = 1;
required string name = 2;
}
message GiftPack {
required int32 id = 1;
required Gift gift = 2;
}

View File

@ -1,4 +1,8 @@
syntax = "proto2";
message UserPack {
required User user = 1;
}
//
message User {
//
@ -54,7 +58,7 @@ message User {
required string content = 4;
optional NobleBoarder boarder = 8;
}
required int32 id = 1;
required int64 id = 1;
required string nickname = 3;
required int32 gender = 4;
//

4732
Demo/resultb.txt Normal file

File diff suppressed because it is too large Load Diff

4489
Demo/resultc.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,17 @@
POST https://webcast3.ixigua.com/webcast/room/6776866251722459918/_fetch_message_polling/?webcast_sdk_version=1350&webcast_language=zh&webcast_locale=zh_CN&iid=97470633732&device_id=55714661189&ac=wifi&channel=xiaomi&aid=32&app_name=video_article&version_code=816&version_name=8.1.6&device_platform=android&ab_version=668859%2C999124%2C668855%2C941090%2C785218%2C668858%2C1046292%2C1073579%2C830454%2C956074%2C1402792%2C929436%2C797199%2C1135476%2C1179370%2C994679%2C900042%2C1113833%2C668854%2C1193963%2C901277%2C1043330%2C994822%2C1002058%2C1230687%2C1189797%2C1143356%2C1143441%2C1143501%2C1143698%2C1143713%2C1243997%2C1395695%2C1395486%2C1398858%2C668852%2C668856%2C668853%2C1186421%2C668851&ssmix=a&device_type=MI+8+SE&device_brand=Xiaomi&language=zh&os_api=28&os_version=9&openudid=70d6668d41512c39&manifest_version_code=416&resolution=1080*2029&dpi=480&update_version_code=81606&_rticket=1577867432094&cdid_ts=1577625556989&fp=a_fake_fp&tma_jssdk_version=1.29.1.1&rom_version=miui_V11_V11.0.3.0.PEBCNXM&cdid=778dbd7e-1536-475b-9624-95b13598ebd1&oaid=a625f466e0975d42 HTTP/1.1
Host: webcast3.ixigua.com
Connection: keep-alive
Content-Length: 316
Cookie: install_id=97470633732; ttreq=1$3f04d8c6f9873fc560ea72b7cf6172815f5d3e7a; _ga=GA1.2.108127775.1577766259; msh=tv_McCXsGpmOcfszgooF-zSdZrA; d_ticket=b11bc347dec250de4692d89482e9689c93530; sid_guard=ff580c5b8a39c05d9f26001f2a337b2a%7C1577853576%7C5184000%7CSun%2C+01-Mar-2020+04%3A39%3A36+GMT; uid_tt=a53fa4ca5af7097f3c8ffd63ec3ad058; sid_tt=ff580c5b8a39c05d9f26001f2a337b2a; sessionid=ff580c5b8a39c05d9f26001f2a337b2a; odin_tt=772ada2984c0695e52569ee34d11382821b2c684e498e00ee7392f982097eb3f61101a57cd929593f650770b863fb982; qh[360]=1
X-Tt-Token: 00ff580c5b8a39c05d9f26001f2a337b2a56bd1d24d0c8c74431df91bf03927a736d9883ae06d9498a1249e6db08c3fb4426
sdk-version: 1
User-Agent: Dalvik/2.1.0 (Linux; U; Android 9; MI 8 SE MIUI/V11.0.3.0.PEBCNXM) VideoArticle/8.1.6 cronet/TTNetVersion:4df3ca9d 2019-11-25
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
X-SS-STUB: 5AEDCEB8B350A716E6D12AD1B0B349DF
X-SS-DP: 32
x-tt-trace-id: 00-603a521609cf8da43457450e8e3b0020-603a521609cf8da4-01
Accept-Encoding: gzip, deflate
X-Khronos: 1577867432
X-Gorgon: 040160c30000eee3b5b198cd094ba340a3d3bde1b658e75e8d97
cursor={cursor}&resp_content_type=protobuf&last_rtt=138&live_id=3&user_id=0&identity=audience&recv_cnt=8&parse_cnt=8&internal_ext={internal_ext}

View File

@ -20,7 +20,7 @@ DESCRIPTOR = _descriptor.FileDescriptor(
package='',
syntax='proto2',
serialized_options=None,
serialized_pb=b'\n\x11XiguaCommon.proto\x1a\x0fXiguaUser.proto\x1a\x0fXiguaGift.proto\";\n\x07Message\x12\x1f\n\ncommonInfo\x18\x01 \x02(\x0b\x32\x0b.CommonInfo\x12\x0f\n\x07\x63ontent\x18\x03 \x01(\t\"*\n\x05Style\x12\r\n\x05\x63olor\x18\x01 \x01(\t\x12\x12\n\nfontWeight\x18\x04 \x01(\x05\"g\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\x13\n\x04user\x18\x15 \x01(\x0b\x32\x05.User\x12\x13\n\x04gift\x18\x16 \x01(\x0b\x32\x05.Gift\"_\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 \x03(\x0b\x32\x07.Params\"u\n\nCommonInfo\x12\x0e\n\x06method\x18\x01 \x01(\t\x12\x0e\n\x06msg_id\x18\x02 \x01(\x05\x12\x0f\n\x07room_id\x18\x03 \x01(\x05\x12\x13\n\x0b\x63reate_time\x18\x04 \x01(\x05\x12!\n\x0b\x64isplayText\x18\x08 \x01(\x0b\x32\x0c.DisplayText'
serialized_pb=b'\n\x11XiguaCommon.proto\x1a\x0fXiguaUser.proto\x1a\x0fXiguaGift.proto\";\n\x07Message\x12\x1f\n\ncommonInfo\x18\x01 \x02(\x0b\x32\x0b.CommonInfo\x12\x0f\n\x07\x63ontent\x18\x03 \x01(\t\"*\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\"u\n\nCommonInfo\x12\x0e\n\x06method\x18\x01 \x01(\t\x12\x0e\n\x06msg_id\x18\x02 \x01(\x05\x12\x0f\n\x07room_id\x18\x03 \x01(\x05\x12\x13\n\x0b\x63reate_time\x18\x04 \x01(\x05\x12!\n\x0b\x64isplayText\x18\x08 \x01(\x0b\x32\x0c.DisplayText'
,
dependencies=[XiguaUser__pb2.DESCRIPTOR,XiguaGift__pb2.DESCRIPTOR,])
@ -132,14 +132,14 @@ _PARAMS = _descriptor.Descriptor(
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='user', full_name='Params.user', index=3,
name='users', full_name='Params.users', index=3,
number=21, 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,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='gift', full_name='Params.gift', index=4,
name='gifts', full_name='Params.gifts', index=4,
number=22, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
@ -158,7 +158,7 @@ _PARAMS = _descriptor.Descriptor(
oneofs=[
],
serialized_start=160,
serialized_end=263,
serialized_end=273,
)
@ -192,8 +192,8 @@ _DISPLAYTEXT = _descriptor.Descriptor(
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='params', full_name='DisplayText.params', index=3,
number=4, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
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),
@ -209,8 +209,8 @@ _DISPLAYTEXT = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=265,
serialized_end=360,
serialized_start=275,
serialized_end=370,
)
@ -268,14 +268,14 @@ _COMMONINFO = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=362,
serialized_end=479,
serialized_start=372,
serialized_end=489,
)
_MESSAGE.fields_by_name['commonInfo'].message_type = _COMMONINFO
_PARAMS.fields_by_name['style'].message_type = _STYLE
_PARAMS.fields_by_name['user'].message_type = XiguaUser__pb2._USER
_PARAMS.fields_by_name['gift'].message_type = XiguaGift__pb2._GIFT
_PARAMS.fields_by_name['users'].message_type = XiguaUser__pb2._USERPACK
_PARAMS.fields_by_name['gifts'].message_type = XiguaGift__pb2._GIFTPACK
_DISPLAYTEXT.fields_by_name['bgStyle'].message_type = _STYLE
_DISPLAYTEXT.fields_by_name['params'].message_type = _PARAMS
_COMMONINFO.fields_by_name['displayText'].message_type = _DISPLAYTEXT

View File

@ -18,28 +18,28 @@ DESCRIPTOR = _descriptor.FileDescriptor(
package='',
syntax='proto2',
serialized_options=None,
serialized_pb=b'\n\x0fXiguaGift.proto\"\\\n\x04Gift\x12\n\n\x02id\x18\x01 \x02(\x05\x12\x1a\n\x04gift\x18\x02 \x02(\x0b\x32\x0c.Gift.Detail\x1a,\n\x06\x44\x65tail\x12\x0f\n\x07gift_id\x18\x01 \x02(\t\x12\x11\n\tgift_name\x18\x02 \x02(\t'
serialized_pb=b'\n\x0fXiguaGift.proto\" \n\x04Gift\x12\n\n\x02id\x18\x01 \x02(\t\x12\x0c\n\x04name\x18\x02 \x02(\t\"+\n\x08GiftPack\x12\n\n\x02id\x18\x01 \x02(\x05\x12\x13\n\x04gift\x18\x02 \x02(\x0b\x32\x05.Gift'
)
_GIFT_DETAIL = _descriptor.Descriptor(
name='Detail',
full_name='Gift.Detail',
_GIFT = _descriptor.Descriptor(
name='Gift',
full_name='Gift',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='gift_id', full_name='Gift.Detail.gift_id', index=0,
name='id', full_name='Gift.id', index=0,
number=1, 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='gift_name', full_name='Gift.Detail.gift_name', index=1,
name='name', full_name='Gift.name', 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,
@ -57,26 +57,27 @@ _GIFT_DETAIL = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=67,
serialized_end=111,
serialized_start=19,
serialized_end=51,
)
_GIFT = _descriptor.Descriptor(
name='Gift',
full_name='Gift',
_GIFTPACK = _descriptor.Descriptor(
name='GiftPack',
full_name='GiftPack',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='id', full_name='Gift.id', index=0,
name='id', full_name='GiftPack.id', index=0,
number=1, 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='gift', full_name='Gift.gift', index=1,
name='gift', full_name='GiftPack.gift', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
@ -85,7 +86,7 @@ _GIFT = _descriptor.Descriptor(
],
extensions=[
],
nested_types=[_GIFT_DETAIL, ],
nested_types=[],
enum_types=[
],
serialized_options=None,
@ -94,29 +95,28 @@ _GIFT = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=19,
serialized_end=111,
serialized_start=53,
serialized_end=96,
)
_GIFT_DETAIL.containing_type = _GIFT
_GIFT.fields_by_name['gift'].message_type = _GIFT_DETAIL
_GIFTPACK.fields_by_name['gift'].message_type = _GIFT
DESCRIPTOR.message_types_by_name['Gift'] = _GIFT
DESCRIPTOR.message_types_by_name['GiftPack'] = _GIFTPACK
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
Gift = _reflection.GeneratedProtocolMessageType('Gift', (_message.Message,), {
'Detail' : _reflection.GeneratedProtocolMessageType('Detail', (_message.Message,), {
'DESCRIPTOR' : _GIFT_DETAIL,
'__module__' : 'XiguaGift_pb2'
# @@protoc_insertion_point(class_scope:Gift.Detail)
})
,
'DESCRIPTOR' : _GIFT,
'__module__' : 'XiguaGift_pb2'
# @@protoc_insertion_point(class_scope:Gift)
})
_sym_db.RegisterMessage(Gift)
_sym_db.RegisterMessage(Gift.Detail)
GiftPack = _reflection.GeneratedProtocolMessageType('GiftPack', (_message.Message,), {
'DESCRIPTOR' : _GIFTPACK,
'__module__' : 'XiguaGift_pb2'
# @@protoc_insertion_point(class_scope:GiftPack)
})
_sym_db.RegisterMessage(GiftPack)
# @@protoc_insertion_point(module_scope)

View File

@ -18,12 +18,43 @@ DESCRIPTOR = _descriptor.FileDescriptor(
package='',
syntax='proto2',
serialized_options=None,
serialized_pb=b'\n\x0fXiguaUser.proto\"\x96\x07\n\x04User\x12\n\n\x02id\x18\x01 \x02(\x05\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\x1a\n\x05\x62\x61\x64ge\x18\x15 \x03(\x0b\x32\x0b.User.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\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\xcd\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\x17.User.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\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\xa1\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\x1a\n\x05\x62\x61\x64ge\x18\x13 \x02(\x0b\x32\x0b.User.Badge\x12\x17\n\x0ftoNextLevelNeed\x18\x15 \x01(\x05\x1a(\n\nHonorLevel\x12\x1a\n\x05\x62\x61\x64ge\x18\x13 \x02(\x0b\x32\x0b.User.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\"\x96\x07\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\x1a\n\x05\x62\x61\x64ge\x18\x15 \x03(\x0b\x32\x0b.User.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\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\xcd\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\x17.User.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\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\xa1\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\x1a\n\x05\x62\x61\x64ge\x18\x13 \x02(\x0b\x32\x0b.User.Badge\x12\x17\n\x0ftoNextLevelNeed\x18\x15 \x01(\x05\x1a(\n\nHonorLevel\x12\x1a\n\x05\x62\x61\x64ge\x18\x13 \x02(\x0b\x32\x0b.User.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'
)
_USERPACK = _descriptor.Descriptor(
name='UserPack',
full_name='UserPack',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='user', full_name='UserPack.user', 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),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=19,
serialized_end=50,
)
_USER_AVATAR = _descriptor.Descriptor(
name='Avatar',
full_name='User.Avatar',
@ -57,8 +88,8 @@ _USER_AVATAR = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=291,
serialized_end=324,
serialized_start=324,
serialized_end=357,
)
_USER_BADGE_FANCLUBTEXT = _descriptor.Descriptor(
@ -101,8 +132,8 @@ _USER_BADGE_FANCLUBTEXT = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=475,
serialized_end=532,
serialized_start=508,
serialized_end=565,
)
_USER_BADGE = _descriptor.Descriptor(
@ -173,8 +204,8 @@ _USER_BADGE = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=327,
serialized_end=532,
serialized_start=360,
serialized_end=565,
)
_USER_FOLLOW = _descriptor.Descriptor(
@ -210,8 +241,8 @@ _USER_FOLLOW = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=534,
serialized_end=585,
serialized_start=567,
serialized_end=618,
)
_USER_PAYGRADE = _descriptor.Descriptor(
@ -282,8 +313,8 @@ _USER_PAYGRADE = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=588,
serialized_end=749,
serialized_start=621,
serialized_end=782,
)
_USER_HONORLEVEL = _descriptor.Descriptor(
@ -312,8 +343,8 @@ _USER_HONORLEVEL = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=751,
serialized_end=791,
serialized_start=784,
serialized_end=824,
)
_USER_NOBLE_NOBLEBOARDER = _descriptor.Descriptor(
@ -363,8 +394,8 @@ _USER_NOBLE_NOBLEBOARDER = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=863,
serialized_end=938,
serialized_start=896,
serialized_end=971,
)
_USER_NOBLE = _descriptor.Descriptor(
@ -400,8 +431,8 @@ _USER_NOBLE = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=794,
serialized_end=938,
serialized_start=827,
serialized_end=971,
)
_USER = _descriptor.Descriptor(
@ -413,7 +444,7 @@ _USER = _descriptor.Descriptor(
fields=[
_descriptor.FieldDescriptor(
name='id', full_name='User.id', index=0,
number=1, type=5, cpp_type=1, label=2,
number=1, type=3, cpp_type=2, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
@ -493,10 +524,11 @@ _USER = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=20,
serialized_end=938,
serialized_start=53,
serialized_end=971,
)
_USERPACK.fields_by_name['user'].message_type = _USER
_USER_AVATAR.containing_type = _USER
_USER_BADGE_FANCLUBTEXT.containing_type = _USER_BADGE
_USER_BADGE.fields_by_name['fanClubText'].message_type = _USER_BADGE_FANCLUBTEXT
@ -515,9 +547,17 @@ _USER.fields_by_name['avatarLarge'].message_type = _USER_AVATAR
_USER.fields_by_name['badge'].message_type = _USER_BADGE
_USER.fields_by_name['follow'].message_type = _USER_FOLLOW
_USER.fields_by_name['payGrade'].message_type = _USER_PAYGRADE
DESCRIPTOR.message_types_by_name['UserPack'] = _USERPACK
DESCRIPTOR.message_types_by_name['User'] = _USER
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
UserPack = _reflection.GeneratedProtocolMessageType('UserPack', (_message.Message,), {
'DESCRIPTOR' : _USERPACK,
'__module__' : 'XiguaUser_pb2'
# @@protoc_insertion_point(class_scope:UserPack)
})
_sym_db.RegisterMessage(UserPack)
User = _reflection.GeneratedProtocolMessageType('User', (_message.Message,), {
'Avatar' : _reflection.GeneratedProtocolMessageType('Avatar', (_message.Message,), {

78
api.py
View File

@ -11,6 +11,7 @@ from Struct.Lottery import Lottery
import requests
import time
from datetime import datetime, timedelta
from Xigua_pb2 import XiguaLive
DEBUG = False
COMMON_GET_PARAM = (
@ -26,7 +27,10 @@ SEARCH_USER_API = (
"https://security.snssdk.com/video/app/search/live/?format=json&search_sug=0&forum=0&m_tab=live&is_native_req=0"
"&offset=0&from=live&en_qc=1&pd=xigua_live&ssmix=a{COMMON}&keyword={keyword}")
USER_INFO_API = "https://is.snssdk.com/video/app/user/home/v7/?to_user_id={userId}{COMMON}"
ROOM_INFO_API = "https://webcast3.ixigua.com/webcast/room/enter/?room_id={roomId}&pack_level=4{COMMON}"
ROOM_INFO_API = ("https://webcast3.ixigua.com/webcast/room/enter/?room_id={roomId}&webcast_sdk_version=1350"
"&webcast_language=zh&webcast_locale=zh_CN&pack_level=4{COMMON}")
DANMAKU_GET_API = ("https://webcast3.ixigua.com/webcast/room/{roomId}/_fetch_message_polling/?webcast_sdk_version=1350"
"&webcast_language=zh&webcast_locale=zh_CN{COMMON}")
COMMON_HEADERS = {
"sdk-version": '1',
"User-Agent": "Dalvik/2.1.0 (Linux; U; Android 9) VideoArticle/8.1.6 cronet/TTNetVersion:b97574c0 2019-09-24",
@ -59,12 +63,13 @@ class XiGuaLiveApi:
self._rawRoomInfo = {}
self.roomID = 0
self.roomPopularity = 0
self._cursor = "0"
self.lottery = None
self.s = requests.session()
self.s.headers.update(COMMON_HEADERS)
self._updRoomAt = datetime.fromtimestamp(0)
self.updRoomInfo()
self._ext = ""
self._cursor = ""
def _updateRoomPopularity(self, _data):
"""
@ -331,60 +336,33 @@ class XiGuaLiveApi:
获取弹幕
"""
self.updRoomInfo()
p = self.s.get("https://i.snssdk.com/videolive/im/get_msg?cursor={cursor}&room_id={roomID}"
"&version_code=800&device_platform=android".format(
roomID=self.roomID,
cursor=self._cursor
))
d = p.json()
if "data" not in d or "extra" not in d or "cursor" not in d["extra"]:
if "base_resp" in d and d["base_resp"]["status_code"] != 10038:
print(d["base_resp"]["status_message"])
self.apiChangedError("接口数据返回错误", d)
return
else:
self._cursor = d["extra"]["cursor"]
if DEBUG:
print("Cursor:\t", self._cursor)
for i in d['data']:
if DEBUG:
print(i)
if "common" not in i and "method" not in i["common"]:
continue
if i["common"]['method'] == "VideoLivePresentMessage":
self.onPresent(Gift(i))
elif i["common"]['method'] == "VideoLivePresentEndTipMessage":
self.onPresentEnd(Gift(i))
# elif i["common"]['method'] == "VideoLiveRoomAdMessage":
# self.onAd(i)
# elif i["common"]['method'] == "VideoLiveChatMessage":
# self.onChat(Chat(i, self.lottery))
# elif i["common"]['method'] == "VideoLiveMemberMessage":
# self.onEnter(MemberMsg(i))
# self._updateRoomPopularity(i)
# elif i["common"]['method'] == "VideoLiveSocialMessage":
# self.onSubscribe(User(i))
# elif i["common"]['method'] == "VideoLiveJoinDiscipulusMessage":
# self.onJoin(User(i))
# elif i["common"]['method'] == "VideoLiveControlMessage":
# print("消息:", "主播离开一小会")
# # 这个消息代表主播下播了,直接更新房间信息
# self.updRoomInfo(True)
# elif i["common"]['method'] == "VideoLiveDiggMessage":
# self.onLike(User(i))
_formatData = {"COMMON": COMMON_GET_PARAM, "TIMESTAMP": time.time() * 1000, "roomId": self.roomID}
_url = DANMAKU_GET_API.format_map(_formatData).format_map(_formatData)
p = self.s.post(_url, data="cursor={cursor}&resp_content_type=protobuf&live_id=3&user_id=0&identity=audience"
"&internal_ext={ext}".format_map({"cursor": self._cursor, "ext": self._ext}),
headers={"Content-Type": "application/x-www-form-urlencoded"})
data = XiguaLive()
data.ParseFromString(p.content)
f = open("Demo/a.txt", 'wb')
f.write(p.content)
f.close()
self._cursor = data.cursor
self._ext = data.internal_ext
for _each in data.data:
if _each.method == "WebcastGiftMessage":
print("Gift\t", _each.message.commonInfo.displayText.params.gifts.id, "\t",
_each.message.commonInfo.displayText.params.users.user.nickname,
_each.message.commonInfo.displayText.params.gifts.gift.name,
_each.message.commonInfo.displayText.params.string)
else:
pass
if self.lottery is None or self.lottery.ID == 0:
self.lottery = Lottery(i)
# 更新抽奖信息
if self.lottery is not None and self.lottery.ID != 0:
self.lottery.update()
if self.lottery.isFinished:
self.onLottery(self.lottery)
self.lottery = None
# 2分钟自动更新下房间信息
self.updRoomInfo(len(d['data']) == 0)
time.sleep(1)
if __name__ == "__main__":
name = "永恒de草薙"
@ -393,13 +371,13 @@ if __name__ == "__main__":
DEBUG = True
name = sys.argv[1]
print("西瓜直播弹幕助手 by JerryYan")
print("搜索【", name, "", end="\t", flush=True)
print("搜索【", name, "", end="\t", flush=True)
api = XiGuaLiveApi(name)
if not api.isValidUser:
input("用户不存在")
sys.exit()
print("OK")
print("直播用户:", api.broadcaster)
print(api.broadcaster.__repr__())
print("更新房间信息,请稍后", end="\t", flush=True)
if api.updRoomInfo(True):
print("OK")