例行升级(9.1.8->9.2.6),删除被动更新礼物,删除抽奖检测
This commit is contained in:
parent
bf5c4f760a
commit
6b1a4a7b0a
BIN
Demo/242_.txt
Normal file
BIN
Demo/242_.txt
Normal file
Binary file not shown.
1036
Demo/v926.txt
Normal file
1036
Demo/v926.txt
Normal file
File diff suppressed because it is too large
Load Diff
256
Demo/v926_fg.txt
Normal file
256
Demo/v926_fg.txt
Normal file
@ -0,0 +1,256 @@
|
||||
1 {
|
||||
1: "WebcastChatMessage"
|
||||
2 {
|
||||
1 {
|
||||
1: "WebcastChatMessage"
|
||||
2: 6902669212519992068
|
||||
3: 6902629276546566925
|
||||
6: 1
|
||||
8 {
|
||||
1: "webcast_chat_display_text"
|
||||
2: "{0:user}{1:string}"
|
||||
3 {
|
||||
1: "#ff36c0cf"
|
||||
4: 400
|
||||
}
|
||||
4 {
|
||||
1: 11
|
||||
2 {
|
||||
1: "#60000000"
|
||||
4: 400
|
||||
}
|
||||
21 {
|
||||
1 {
|
||||
1: 5518138898
|
||||
3: "\345\247\232\345\247\232\347\220\263\347\232\2042\345\247\220\345\244\253"
|
||||
4: 1
|
||||
9 {
|
||||
1: "https://p1-dy.bytexservice.com/img/user-avatar/deb96a5e7e07f60a613531670a570736~300x300.image"
|
||||
}
|
||||
21 {
|
||||
1: "http://p9-webcast-ttcdn.byteimg.com/img/webcast/xigua_admin_badge_v2.png~tplv-obj.image"
|
||||
1: "http://p1-webcast-ttcdn.byteimg.com/img/webcast/xigua_admin_badge_v2.png~tplv-obj.image"
|
||||
2: "webcast/xigua_admin_badge_v2.png"
|
||||
3: 16
|
||||
4: 28
|
||||
6: 3
|
||||
}
|
||||
21 {
|
||||
1: "http://p1-webcast-ttcdn.byteimg.com/img/webcast/25_xigua_honor_level.png~tplv-obj.png"
|
||||
1: "http://p9-webcast-ttcdn.byteimg.com/img/webcast/25_xigua_honor_level.png~tplv-obj.png"
|
||||
2: "webcast/25_xigua_honor_level.png"
|
||||
3: 16
|
||||
4: 30
|
||||
6: 1
|
||||
7: "sslocal://webcast_webview?url=https%3A%2F%2Fwebcast.ixigua.com%2Ffalcon%2Fwebcast_xigua%2Fpage%2Fhonor_level%2Fuser%2Findex.html&hide_nav_bar=1&hide_status_bar=0&__live_platform__=webcast&type=fullscreen"
|
||||
}
|
||||
21 {
|
||||
1: "http://p1-webcast-ttcdn.byteimg.com/img/webcast/xigua_fansclub_medal_15.png~tplv-obj.image"
|
||||
1: "http://p6-webcast-ttcdn.byteimg.com/img/webcast/xigua_fansclub_medal_15.png~tplv-obj.image"
|
||||
2: "webcast/xigua_fansclub_medal_15.png"
|
||||
6: 7
|
||||
8 {
|
||||
1: "\345\247\232\345\247\232\347\220\263"
|
||||
2: "#FFFFFF"
|
||||
3: 15
|
||||
}
|
||||
}
|
||||
22 {
|
||||
1: 13
|
||||
2: 86
|
||||
3: 2
|
||||
}
|
||||
23 {
|
||||
6: 25
|
||||
19 {
|
||||
1: "http://p1-webcast-ttcdn.byteimg.com/img/webcast/25_xigua_honor_level.png~tplv-obj.png"
|
||||
1: "http://p9-webcast-ttcdn.byteimg.com/img/webcast/25_xigua_honor_level.png~tplv-obj.png"
|
||||
2: "webcast/25_xigua_honor_level.png"
|
||||
3: 16
|
||||
4: 30
|
||||
6: 1
|
||||
7: "sslocal://webcast_webview?url=https%3A%2F%2Fwebcast.ixigua.com%2Ffalcon%2Fwebcast_xigua%2Fpage%2Fhonor_level%2Fuser%2Findex.html&hide_nav_bar=1&hide_status_bar=0&__live_platform__=webcast&type=fullscreen"
|
||||
}
|
||||
}
|
||||
24 {
|
||||
1 {
|
||||
1: "\345\247\232\345\247\232\347\220\263"
|
||||
2: 15
|
||||
3: 1
|
||||
4 {
|
||||
1: "\010\002\022\342\001\nZhttp://p1-webcast-ttcdn.byteimg.com/img/webcast/xigua_fansclub_medal_15.png~tplv-obj.image\nZhttp://p6-webcast-ttcdn.byteimg.com/img/webcast/xigua_fansclub_medal_15.png~tplv-obj.image\022#webcast/xigua_fansclub_medal_15.png\0300 \226\001"
|
||||
2: "\345\247\232\345\247\232\347\220\263"
|
||||
}
|
||||
6: 61788610240
|
||||
}
|
||||
}
|
||||
32 {
|
||||
2: 1
|
||||
}
|
||||
38: "0"
|
||||
46: "MS4wLjABAAAAKkWCgUKAN3GtNdQ0jqr8zAt3KtIc9kAc1GaJ32VcH3E"
|
||||
54: 3
|
||||
61 {
|
||||
1: "http://p9-webcast-ttcdn.byteimg.com/img/webcast/xigua_admin_badge_v2.png~tplv-obj.image"
|
||||
1: "http://p1-webcast-ttcdn.byteimg.com/img/webcast/xigua_admin_badge_v2.png~tplv-obj.image"
|
||||
2: "webcast/xigua_admin_badge_v2.png"
|
||||
3: 16
|
||||
4: 28
|
||||
6: 3
|
||||
}
|
||||
61 {
|
||||
1: "http://p1-webcast-ttcdn.byteimg.com/img/webcast/25_xigua_honor_level.png~tplv-obj.png"
|
||||
1: "http://p9-webcast-ttcdn.byteimg.com/img/webcast/25_xigua_honor_level.png~tplv-obj.png"
|
||||
2: "webcast/25_xigua_honor_level.png"
|
||||
3: 16
|
||||
4: 30
|
||||
6: 1
|
||||
7: "sslocal://webcast_webview?url=https%3A%2F%2Fwebcast.ixigua.com%2Ffalcon%2Fwebcast_xigua%2Fpage%2Fhonor_level%2Fuser%2Findex.html&hide_nav_bar=1&hide_status_bar=0&__live_platform__=webcast&type=fullscreen"
|
||||
}
|
||||
61 {
|
||||
1: "http://p1-webcast-ttcdn.byteimg.com/img/webcast/xigua_fansclub_medal_15.png~tplv-obj.image"
|
||||
1: "http://p6-webcast-ttcdn.byteimg.com/img/webcast/xigua_fansclub_medal_15.png~tplv-obj.image"
|
||||
2: "webcast/xigua_fansclub_medal_15.png"
|
||||
6: 7
|
||||
8 {
|
||||
1: "\345\247\232\345\247\232\347\220\263"
|
||||
2: "#FFFFFF"
|
||||
3: 15
|
||||
}
|
||||
}
|
||||
}
|
||||
2: 1
|
||||
}
|
||||
}
|
||||
4 {
|
||||
1: 1
|
||||
11: "@\345\247\232\345\256\266\344\272\214\345\247\221\345\207\211 \346\210\221\345\211\215\345\244\251\346\235\245\346\267\261\345\234\263\344\272\206"
|
||||
}
|
||||
}
|
||||
11: 31003
|
||||
}
|
||||
2 {
|
||||
1: 5518138898
|
||||
3: "\345\247\232\345\247\232\347\220\263\347\232\2042\345\247\220\345\244\253"
|
||||
4: 1
|
||||
9 {
|
||||
1: "https://p1-dy.bytexservice.com/img/user-avatar/deb96a5e7e07f60a613531670a570736~300x300.image"
|
||||
}
|
||||
21 {
|
||||
1: "http://p9-webcast-ttcdn.byteimg.com/img/webcast/xigua_admin_badge_v2.png~tplv-obj.image"
|
||||
1: "http://p1-webcast-ttcdn.byteimg.com/img/webcast/xigua_admin_badge_v2.png~tplv-obj.image"
|
||||
2: "webcast/xigua_admin_badge_v2.png"
|
||||
3: 16
|
||||
4: 28
|
||||
6: 3
|
||||
}
|
||||
21 {
|
||||
1: "http://p1-webcast-ttcdn.byteimg.com/img/webcast/25_xigua_honor_level.png~tplv-obj.png"
|
||||
1: "http://p9-webcast-ttcdn.byteimg.com/img/webcast/25_xigua_honor_level.png~tplv-obj.png"
|
||||
2: "webcast/25_xigua_honor_level.png"
|
||||
3: 16
|
||||
4: 30
|
||||
6: 1
|
||||
7: "sslocal://webcast_webview?url=https%3A%2F%2Fwebcast.ixigua.com%2Ffalcon%2Fwebcast_xigua%2Fpage%2Fhonor_level%2Fuser%2Findex.html&hide_nav_bar=1&hide_status_bar=0&__live_platform__=webcast&type=fullscreen"
|
||||
}
|
||||
21 {
|
||||
1: "http://p1-webcast-ttcdn.byteimg.com/img/webcast/xigua_fansclub_medal_15.png~tplv-obj.image"
|
||||
1: "http://p6-webcast-ttcdn.byteimg.com/img/webcast/xigua_fansclub_medal_15.png~tplv-obj.image"
|
||||
2: "webcast/xigua_fansclub_medal_15.png"
|
||||
6: 7
|
||||
8 {
|
||||
1: "\345\247\232\345\247\232\347\220\263"
|
||||
2: "#FFFFFF"
|
||||
3: 15
|
||||
}
|
||||
}
|
||||
22 {
|
||||
1: 13
|
||||
2: 86
|
||||
3: 2
|
||||
}
|
||||
23 {
|
||||
6: 25
|
||||
19 {
|
||||
1: "http://p1-webcast-ttcdn.byteimg.com/img/webcast/25_xigua_honor_level.png~tplv-obj.png"
|
||||
1: "http://p9-webcast-ttcdn.byteimg.com/img/webcast/25_xigua_honor_level.png~tplv-obj.png"
|
||||
2: "webcast/25_xigua_honor_level.png"
|
||||
3: 16
|
||||
4: 30
|
||||
6: 1
|
||||
7: "sslocal://webcast_webview?url=https%3A%2F%2Fwebcast.ixigua.com%2Ffalcon%2Fwebcast_xigua%2Fpage%2Fhonor_level%2Fuser%2Findex.html&hide_nav_bar=1&hide_status_bar=0&__live_platform__=webcast&type=fullscreen"
|
||||
}
|
||||
}
|
||||
24 {
|
||||
1 {
|
||||
1: "\345\247\232\345\247\232\347\220\263"
|
||||
2: 15
|
||||
3: 1
|
||||
4 {
|
||||
1 {
|
||||
1: 2
|
||||
2 {
|
||||
1: "http://p1-webcast-ttcdn.byteimg.com/img/webcast/xigua_fansclub_medal_15.png~tplv-obj.image"
|
||||
1: "http://p6-webcast-ttcdn.byteimg.com/img/webcast/xigua_fansclub_medal_15.png~tplv-obj.image"
|
||||
2: "webcast/xigua_fansclub_medal_15.png"
|
||||
3: 48
|
||||
4: 150
|
||||
}
|
||||
}
|
||||
2: "\345\247\232\345\247\232\347\220\263"
|
||||
}
|
||||
6: 61788610240
|
||||
}
|
||||
}
|
||||
32 {
|
||||
2: 1
|
||||
}
|
||||
38: "0"
|
||||
46: "MS4wLjABAAAAKkWCgUKAN3GtNdQ0jqr8zAt3KtIc9kAc1GaJ32VcH3E"
|
||||
54: 3
|
||||
61 {
|
||||
1: "http://p9-webcast-ttcdn.byteimg.com/img/webcast/xigua_admin_badge_v2.png~tplv-obj.image"
|
||||
1: "http://p1-webcast-ttcdn.byteimg.com/img/webcast/xigua_admin_badge_v2.png~tplv-obj.image"
|
||||
2: "webcast/xigua_admin_badge_v2.png"
|
||||
3: 16
|
||||
4: 28
|
||||
6: 3
|
||||
}
|
||||
61 {
|
||||
1: "http://p1-webcast-ttcdn.byteimg.com/img/webcast/25_xigua_honor_level.png~tplv-obj.png"
|
||||
1: "http://p9-webcast-ttcdn.byteimg.com/img/webcast/25_xigua_honor_level.png~tplv-obj.png"
|
||||
2: "webcast/25_xigua_honor_level.png"
|
||||
3: 16
|
||||
4: 30
|
||||
6: 1
|
||||
7: "sslocal://webcast_webview?url=https%3A%2F%2Fwebcast.ixigua.com%2Ffalcon%2Fwebcast_xigua%2Fpage%2Fhonor_level%2Fuser%2Findex.html&hide_nav_bar=1&hide_status_bar=0&__live_platform__=webcast&type=fullscreen"
|
||||
}
|
||||
61 {
|
||||
1: "http://p1-webcast-ttcdn.byteimg.com/img/webcast/xigua_fansclub_medal_15.png~tplv-obj.image"
|
||||
1: "http://p6-webcast-ttcdn.byteimg.com/img/webcast/xigua_fansclub_medal_15.png~tplv-obj.image"
|
||||
2: "webcast/xigua_fansclub_medal_15.png"
|
||||
6: 7
|
||||
8 {
|
||||
1: "\345\247\232\345\247\232\347\220\263"
|
||||
2: "#FFFFFF"
|
||||
3: 15
|
||||
}
|
||||
}
|
||||
}
|
||||
3: "@\345\247\232\345\256\266\344\272\214\345\247\221\345\207\211 \346\210\221\345\211\215\345\244\251\346\235\245\346\267\261\345\234\263\344\272\206"
|
||||
9 {
|
||||
1 {
|
||||
1: "http://p3-webcast-ttcdn.byteimg.com/img/webcast/userlabel_regular_chat.png~tplv-obj.image"
|
||||
1: "http://p6-webcast-ttcdn.byteimg.com/img/webcast/userlabel_regular_chat.png~tplv-obj.image"
|
||||
2: "webcast/userlabel_regular_chat.png"
|
||||
5: "#E0BCD4"
|
||||
}
|
||||
2: 11
|
||||
}
|
||||
}
|
||||
3: 6902669212519992068
|
||||
}
|
||||
2: "1607153101490_6902670004165030044_6902669995575083008_1"
|
||||
3: 1000
|
||||
4: 1607153101490
|
||||
5: "fetch_time:1607153101490|start_time:0|fetch_id:6902670004165030042|flag:0|seq:2080|next_cursor:1607153101490_6902670004165030044_6902669995575083008_1"
|
@ -12,7 +12,7 @@
|
||||
|
||||
### 西瓜直播弹幕接口```api.py```
|
||||
|
||||
> - 基于安卓9.1.8
|
||||
> - 基于安卓9.2.6
|
||||
|
||||
### 西瓜直播弹幕助手--礼物端```WinMain.py```
|
||||
|
||||
|
@ -4,13 +4,11 @@ from XiguaMessage_pb2 import GiftMessage
|
||||
|
||||
|
||||
class Gift:
|
||||
roomID = 0
|
||||
giftList = {}
|
||||
|
||||
def __init__(self, json=None):
|
||||
self.ID = 0
|
||||
self.count = 0
|
||||
self.amount = 0
|
||||
self.user = None
|
||||
self.isFinished = False
|
||||
self.backupName = None
|
||||
@ -31,10 +29,6 @@ class Gift:
|
||||
|
||||
def parse(self, json):
|
||||
self.user = User(json)
|
||||
if "common" in json and json["common"] is not None:
|
||||
if Gift.roomID != int(json["common"]["room_id"]):
|
||||
Gift.roomID = int(json["common"]["room_id"])
|
||||
self.update()
|
||||
if "extra" in json and json["extra"] is not None:
|
||||
if "present_info" in json["extra"] and json["extra"]['present_info'] is not None:
|
||||
self.ID = int(json["extra"]['present_info']['id'])
|
||||
@ -42,21 +36,6 @@ class Gift:
|
||||
elif "present_end_info" in json["extra"] and json["extra"]['present_end_info'] is not None:
|
||||
self.ID = int(json["extra"]['present_end_info']['id'])
|
||||
self.count = json["extra"]['present_end_info']['count']
|
||||
if self.ID != 0 and self.ID in self.giftList:
|
||||
self.amount = self.giftList[self.ID]['diamond_count'] * self.count
|
||||
else:
|
||||
self.update()
|
||||
|
||||
@classmethod
|
||||
def update(cls):
|
||||
p = requests.get("https://i.snssdk.com/videolive/gift/get_gift_list?room_id={roomID}"
|
||||
"&version_code=800&device_platform=android".format(roomID=Gift.roomID))
|
||||
d = p.json()
|
||||
if "gift_info" not in d:
|
||||
print("错误:礼物更新失败")
|
||||
else:
|
||||
for i in d["gift_info"]:
|
||||
cls.addGift(i)
|
||||
|
||||
def isAnimate(self):
|
||||
if self.ID != 0 and self.ID in self.giftList:
|
||||
|
@ -196,7 +196,7 @@ if __name__ == "__main__":
|
||||
name = sys.argv[1]
|
||||
resetColor()
|
||||
print("西瓜直播礼物助手 by JerryYan")
|
||||
print("接口版本9.1.8")
|
||||
print("接口版本9.2.6")
|
||||
print("搜索【", name, "】", end="\t", flush=True)
|
||||
api = WinMain(name)
|
||||
if not api.isValidUser:
|
||||
|
55
api.py
55
api.py
@ -5,7 +5,6 @@ from Struct.MemberMsg import MemberMsg
|
||||
from Struct.User import User
|
||||
from Struct.Gift import Gift
|
||||
from Struct.Chat import Chat
|
||||
from Struct.Lottery import Lottery
|
||||
import requests
|
||||
import time
|
||||
from datetime import datetime, timedelta
|
||||
@ -14,13 +13,13 @@ from XiguaMessage_pb2 import FansClubMessage, SocialMessage
|
||||
|
||||
DEBUG = False
|
||||
COMMON_GET_PARAM = (
|
||||
"&iid=844059075938396&device_id=71008241150&channel=xiaomi&aid=32&app_name=video_article&version_code=918"
|
||||
"&version_name=9.1.8&device_platform=android&ab_version=668852,668853,668858,668851,668859,668856,668855,"
|
||||
"&iid=844059075938396&device_id=71008241150&channel=xiaomi&aid=32&app_name=video_article&version_code=926"
|
||||
"&version_name=9.2.6&device_platform=android&ab_version=668852,668853,668858,668851,668859,668856,668855,"
|
||||
"668854,1477978,994679,2186472,1477978,1189797,1635895,1631832,994822,900042,956074,1143356,1046292,1481027,"
|
||||
"929436,994679,1419059,1073579,668854,1143441,668852,668853,941090,668858,668851,668859,668856,1639440,1630487&"
|
||||
"device_typeMI+9&device_type=MI 9&device_brand=Xiaomi&language=zh"
|
||||
"&os_api=29&os_version=10&openudid=4aeb1e2b627697be&manifest_version_code=518&update_version_code=91806"
|
||||
"&_rticket={TIMESTAMP:.0f}&_rticket={TIMESTAMP:.0f}&cdid_ts={TIMESTAMP:.0f}&fp=a_fake_fp&tma_jssdk_version=1790001"
|
||||
"&os_api=29&os_version=10&openudid=4aeb1e2b627697be&manifest_version_code=518&update_version_code=92609"
|
||||
"&_rticket={TIMESTAMP:.0f}&_rticket={TIMESTAMP:.0f}&cdid_ts={TIMESTAMP:.0f}&fp=a_fake_fp&tma_jssdk_version=1830001"
|
||||
"&rom_version=miui_V12_V12.0.5.0.QFACNXM&oaid=693ea85657ef38ca"
|
||||
"&cdid=ed4295e8-5d9a-4cb9-b2a2-04009a3baa2d&oaid=a625f466e0975d42")
|
||||
SEARCH_USER_API = (
|
||||
@ -31,16 +30,19 @@ SEARCH_USER_API = (
|
||||
'&ab_param={{"is_show_filter_feature": 1, "is_hit_new_ui": 1}}'
|
||||
"&search_start_time={TIMESTAMP:.0f}&from=live&en_qc=1&pd=xigua_live&ssmix=a{COMMON}&keyword={keyword}")
|
||||
USER_INFO_API = "https://api100-quic-c-hl.ixigua.com/video/app/user/home/v7/?to_user_id={userId}{COMMON}"
|
||||
ROOM_INFO_API = ("https://webcast3.ixigua.com/webcast/room/enter/?room_id={roomId}&webcast_sdk_version=1350"
|
||||
ROOM_INFO_API = ("https://webcast3-normal-c-hl.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}")
|
||||
GIFT_DATA_API = ("https://webcast.ixigua.com/webcast/gift/list/?room_id={roomId}&fetch_giftlist_from=2"
|
||||
"&webcast_sdk_version=1350&webcast_language=zh&webcast_locale=zh_CN{COMMON}")
|
||||
DANMAKU_GET_API = ("https://webcast3-normal-c-hl.ixigua.com/webcast/room/{roomId}/_fetch_message_polling/?"
|
||||
"webcast_sdk_version=1350&webcast_language=zh&webcast_locale=zh_CN{COMMON}")
|
||||
GIFT_DATA_API = ("https://webcast3-normal-c-hl.ixigua.com/webcast/gift/list/?room_id={roomId}&to_room_id={roomId}&"
|
||||
"gift_scene=1&fetch_giftlist_from=2¤t_network_quality_info={{}}"
|
||||
"&webcast_sdk_version=1790&webcast_language=zh&webcast_locale=zh_CN{COMMON}")
|
||||
COMMON_HEADERS = {
|
||||
"sdk-version": '2',
|
||||
"passport-sdk-version": "19",
|
||||
"User-Agent": "Dalvik/2.1.0 (Linux; U; Android 9) VideoArticle/9.1.8 cronet/TTNetVersion:b97574c0 2020-09-24",
|
||||
"X-SS-DP": "32",
|
||||
"User-Agent": "Dalvik/2.1.0 (Linux; U; Android 10) VideoArticle/9.2.6 cronet/TTNetVersion:828f6f3c 2020-09-06 "
|
||||
"QuicVersion:7aee791b 2020-06-05",
|
||||
"Accept-Encoding": "gzip, deflate"
|
||||
}
|
||||
|
||||
@ -71,7 +73,6 @@ class XiGuaLiveApi:
|
||||
self._rawRoomInfo = {}
|
||||
self.roomID = 0
|
||||
self.roomPopularity = 0
|
||||
self.lottery = None
|
||||
self.s = requests.session()
|
||||
self.s.headers.update(COMMON_HEADERS)
|
||||
self._updRoomAt = datetime.fromtimestamp(0)
|
||||
@ -231,13 +232,6 @@ class XiGuaLiveApi:
|
||||
print("消息 :", "主播离开了")
|
||||
self.updRoomInfo()
|
||||
|
||||
def onLottery(self, i: Lottery):
|
||||
"""
|
||||
中奖的内容
|
||||
:param i:
|
||||
"""
|
||||
print("中奖消息 :", i)
|
||||
|
||||
def _checkUsernameIsMatched(self, compare=None):
|
||||
"""
|
||||
验证主播名字是自己想要的那个
|
||||
@ -320,11 +314,6 @@ class XiGuaLiveApi:
|
||||
self._rawRoomInfo = d["user_info"]['live_info']
|
||||
if self.isLive:
|
||||
self.roomID = d["user_info"]['live_info']['room_id']
|
||||
# 处理抽奖事件
|
||||
l = Lottery(self._rawRoomInfo)
|
||||
if l.isActive:
|
||||
# 因为现在每个房间只能同时开启一个抽奖,所以放一个就行了
|
||||
self.lottery = l
|
||||
return True
|
||||
|
||||
def _getRoomInfo(self, force=False):
|
||||
@ -348,7 +337,6 @@ class XiGuaLiveApi:
|
||||
self.isLive = d["data"]["status"] == 2
|
||||
self._updRoomAt = datetime.now()
|
||||
self._updateRoomPopularity(d)
|
||||
Gift.roomID = self.roomID
|
||||
return self.isLive
|
||||
|
||||
def updRoomInfo(self, force=False):
|
||||
@ -372,12 +360,9 @@ class XiGuaLiveApi:
|
||||
_formatData['COMMON'] = _COMMON
|
||||
_url = GIFT_DATA_API.format_map(_formatData)
|
||||
d = self.getJson(_url)
|
||||
Gift.roomID = self.roomID
|
||||
if d is None or d["status_code"] != 0:
|
||||
Gift.update()
|
||||
elif 'pages' not in d["data"]:
|
||||
Gift.update()
|
||||
else:
|
||||
return "异常"
|
||||
elif 'pages' in d["data"]:
|
||||
for _page in d["data"]['pages']:
|
||||
if 'gifts' in _page:
|
||||
for _gift in _page['gifts']:
|
||||
@ -392,7 +377,7 @@ class XiGuaLiveApi:
|
||||
_formatData = {"TIMESTAMP": time.time() * 1000, "roomId": self.roomID}
|
||||
_COMMON = COMMON_GET_PARAM.format_map(_formatData)
|
||||
_formatData['COMMON'] = _COMMON
|
||||
_url = DANMAKU_GET_API.format_map(_formatData).format_map(_formatData)
|
||||
_url = DANMAKU_GET_API.format_map(_formatData)
|
||||
p = self.s.post(_url, data="cursor={cursor}&resp_content_type=protobuf&live_id=3&user_id=0&identity=audience"
|
||||
"last_rtt=85"
|
||||
"&internal_ext={ext}".format_map({"cursor": self._cursor, "ext": self._ext}),
|
||||
@ -429,12 +414,6 @@ class XiGuaLiveApi:
|
||||
self.onMessage(_fansClubMessage.content)
|
||||
else:
|
||||
pass
|
||||
# 更新抽奖信息
|
||||
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
|
||||
|
||||
@property
|
||||
def updateAt(self):
|
||||
@ -448,7 +427,7 @@ if __name__ == "__main__":
|
||||
DEBUG = True
|
||||
name = sys.argv[1]
|
||||
print("西瓜直播弹幕助手 by JerryYan")
|
||||
print("接口版本8.4.4")
|
||||
print("接口版本9.2.6")
|
||||
print("搜索【", name, "】", end="\t", flush=True)
|
||||
api = XiGuaLiveApi(name)
|
||||
if not api.isValidUser:
|
||||
|
Reference in New Issue
Block a user