DEMO
This commit is contained in:
parent
e402595a75
commit
a3b9f52684
1
Demo/256_.json
Executable file
1
Demo/256_.json
Executable file
File diff suppressed because one or more lines are too long
BIN
Demo/324_.txt
Normal file
BIN
Demo/324_.txt
Normal file
Binary file not shown.
91
Demo/Xigua.proto
Executable file
91
Demo/Xigua.proto
Executable file
@ -0,0 +1,91 @@
|
|||||||
|
syntax = "proto2";
|
||||||
|
// 用户信息
|
||||||
|
message User {
|
||||||
|
// 头像
|
||||||
|
message Avatar {
|
||||||
|
optional string url = 1;
|
||||||
|
}
|
||||||
|
// 头衔
|
||||||
|
message Prefix {
|
||||||
|
message FanClubText {
|
||||||
|
required string text = 1;
|
||||||
|
optional string color = 2;
|
||||||
|
required int32 level = 3;
|
||||||
|
}
|
||||||
|
repeated string url = 1;
|
||||||
|
optional string localUrl = 2;
|
||||||
|
optional string clickTo = 7;
|
||||||
|
optional FanClubText fanClub = 8;
|
||||||
|
}
|
||||||
|
// 花钱等级
|
||||||
|
message PayGrade {
|
||||||
|
required int32 level = 6;
|
||||||
|
optional string unknownThing = 13;
|
||||||
|
optional Prefix prefix = 19;
|
||||||
|
}
|
||||||
|
// 荣誉等级
|
||||||
|
message HonorLevel {
|
||||||
|
required Prefix rpefix = 19;
|
||||||
|
}
|
||||||
|
required int32 id = 1;
|
||||||
|
required string nickname = 3;
|
||||||
|
optional Avatar avatar = 9;
|
||||||
|
repeated Prefix prefix = 21;
|
||||||
|
required PayGrade payGrade = 23;
|
||||||
|
}
|
||||||
|
// 样式
|
||||||
|
message Style {
|
||||||
|
optional string color = 1;
|
||||||
|
optional int32 fontWeight = 4;
|
||||||
|
}
|
||||||
|
// 礼物
|
||||||
|
message Gift {
|
||||||
|
message Detail {
|
||||||
|
required string gift_id = 1;
|
||||||
|
required string gift_name = 2;
|
||||||
|
}
|
||||||
|
required int32 id = 1;
|
||||||
|
required Detail gift = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
message XiguaLiveRoom {
|
||||||
|
message Data {
|
||||||
|
message Message {
|
||||||
|
// 通用定义
|
||||||
|
message Common {
|
||||||
|
// 自定义显示信息
|
||||||
|
message CustomDisplay {
|
||||||
|
// 参数
|
||||||
|
message Params {
|
||||||
|
required int32 type = 1;
|
||||||
|
optional Style style = 2;
|
||||||
|
optional string string = 11;
|
||||||
|
optional User user = 21;
|
||||||
|
optional Gift gift = 22;
|
||||||
|
}
|
||||||
|
required string method = 1;
|
||||||
|
required string format = 2;
|
||||||
|
optional Style bgStyle = 3;
|
||||||
|
optional Params params = 4;
|
||||||
|
}
|
||||||
|
optional string method = 1;
|
||||||
|
optional int32 msg_id = 2;
|
||||||
|
optional int32 room_id = 3;
|
||||||
|
optional int32 create_time = 4;
|
||||||
|
optional CustomDisplay customDisplay = 8;
|
||||||
|
}
|
||||||
|
required Common common = 1;
|
||||||
|
optional string content = 3;
|
||||||
|
}
|
||||||
|
// WebcastChatMessage 聊天
|
||||||
|
// WebcastGiftMessage 礼物
|
||||||
|
required string method = 1;
|
||||||
|
required Message message = 2;
|
||||||
|
}
|
||||||
|
repeated Data data = 1;
|
||||||
|
required string cursor = 2;
|
||||||
|
optional int32 fetch_interval = 3;
|
||||||
|
optional int32 now = 4;
|
||||||
|
required string internal_ext = 5;
|
||||||
|
}
|
1104
Demo/result.txt
Executable file
1104
Demo/result.txt
Executable file
File diff suppressed because it is too large
Load Diff
4406
Demo/result2.txt
Executable file
4406
Demo/result2.txt
Executable file
File diff suppressed because it is too large
Load Diff
1434
Demo/result3.txt
Executable file
1434
Demo/result3.txt
Executable file
File diff suppressed because it is too large
Load Diff
13
api.py
13
api.py
@ -12,7 +12,6 @@ import requests
|
|||||||
import time
|
import time
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
|
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
COMMON_GET_PARAM = (
|
COMMON_GET_PARAM = (
|
||||||
"&iid=96159232732&device_id=55714661189&channel=xiaomi&aid=32&app_name=video_article&version_code=812"
|
"&iid=96159232732&device_id=55714661189&channel=xiaomi&aid=32&app_name=video_article&version_code=812"
|
||||||
@ -25,6 +24,10 @@ COMMON_GET_PARAM = (
|
|||||||
"&manifest_version_code=412&update_version_code=81206&_rticket=1577627203917"
|
"&manifest_version_code=412&update_version_code=81206&_rticket=1577627203917"
|
||||||
"&_rticket=1577627935921&cdid_ts=1577625556989&fp=a_fake_fp&tma_jssdk_version=1290000"
|
"&_rticket=1577627935921&cdid_ts=1577625556989&fp=a_fake_fp&tma_jssdk_version=1290000"
|
||||||
"&cdid=ed4295e8-5d9a-4cb9-b2a2-04009a3baa2d&oaid=a625f466e0975d42")
|
"&cdid=ed4295e8-5d9a-4cb9-b2a2-04009a3baa2d&oaid=a625f466e0975d42")
|
||||||
|
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}")
|
||||||
|
|
||||||
|
|
||||||
class XiGuaLiveApi:
|
class XiGuaLiveApi:
|
||||||
@ -156,7 +159,7 @@ class XiGuaLiveApi:
|
|||||||
print("消息 :", "主播离开了")
|
print("消息 :", "主播离开了")
|
||||||
self.updRoomInfo()
|
self.updRoomInfo()
|
||||||
|
|
||||||
def onLottery(self, i:Lottery):
|
def onLottery(self, i: Lottery):
|
||||||
"""
|
"""
|
||||||
中奖的内容
|
中奖的内容
|
||||||
:param i:
|
:param i:
|
||||||
@ -179,9 +182,7 @@ class XiGuaLiveApi:
|
|||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
p = self.s.get("https://security.snssdk.com/video/app/search/live/?format=json&search_sug=0&forum=0"
|
p = self.s.get(SEARCH_USER_API.format(COMMON=COMMON_GET_PARAM, keyword=self.name))
|
||||||
"&m_tab=live&is_native_req=0&offset=0&from=live&en_qc=1&pd=xigua_live&ssmix=a"
|
|
||||||
"&keyword={}{}".format(self.name, COMMON_GET_PARAM))
|
|
||||||
d = p.json()
|
d = p.json()
|
||||||
except json.decoder.JSONDecodeError as e:
|
except json.decoder.JSONDecodeError as e:
|
||||||
self.apiChangedError("搜索接口错误", e.__str__())
|
self.apiChangedError("搜索接口错误", e.__str__())
|
||||||
@ -258,7 +259,7 @@ class XiGuaLiveApi:
|
|||||||
return self._forceSearchUser()
|
return self._forceSearchUser()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def findRoomByUserId(userId:int):
|
def findRoomByUserId(userId: int):
|
||||||
"""
|
"""
|
||||||
通过UserId查找用户的房间号(已弃用)
|
通过UserId查找用户的房间号(已弃用)
|
||||||
:param userId: 用户ID
|
:param userId: 用户ID
|
||||||
|
Reference in New Issue
Block a user