From 79f3528379ad7fc0ad99b45bbf17840063b84ac9 Mon Sep 17 00:00:00 2001 From: Dawnspace <1050596704@qq.com> Date: Sat, 14 Jul 2018 16:25:07 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=B4=E6=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OnlineHeart.py | 2 +- README.md | 7 +------ bilibiliCilent.py | 42 ++++++++++++++++++++++++++++++++++-------- login.py | 14 +++++++------- 4 files changed, 43 insertions(+), 22 deletions(-) diff --git a/OnlineHeart.py b/OnlineHeart.py index 062909e..ff4968e 100644 --- a/OnlineHeart.py +++ b/OnlineHeart.py @@ -26,7 +26,7 @@ async def heart_gift(self): # 因为休眠时间差不多,所以放到这里,此为实验性功能 async def draw_lottery(self): black_list = ["测试", "test"] - for i in range(74, 90): + for i in range(87, 95): response = await bilibili().get_lotterylist(i) json_response = await response.json() if json_response['code'] == 0: diff --git a/README.md b/README.md index 690761c..53d5e57 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,6 @@ # bilibili-live-tools -项目又经过了一天的重构。差不多能当python课设交上去了(´;ω;`) - -学业繁忙,准备弃坑咕咕咕(flag),风暴初版已上传,不再更新后几版 - -//时隔多日打算学一下图形化,说不定会以这个项目作为样本(flag) - 同级项目开坑: https://github.com/Dawnnnnnn/bilibili-tools 开放识别登录验证码接口: @@ -23,6 +17,7 @@ 双端心跳领取经验 领取银瓜子宝箱 提交每日任务 + C位抽奖 摩天大楼全站抽奖 小电视PC端抽奖 领取每日包裹奖励 diff --git a/bilibiliCilent.py b/bilibiliCilent.py index 68c0e42..4c76398 100644 --- a/bilibiliCilent.py +++ b/bilibiliCilent.py @@ -251,6 +251,7 @@ async def ReceiveMessageLoop(self): async def parseDanMu(self, messages): try: dic = json.loads(messages) + # print(dic) except: return @@ -295,16 +296,14 @@ async def parseDanMu(self, messages): print('SYS_MSG出错,请联系开发者', dic) if cmd == 'GUARD_MSG': + # {'cmd': 'GUARD_MSG', 'msg': '用户 :?苏油条:? 在主播 -猫大人- 的直播间开通了总督' + # , 'buy_type': 1, 'msg_new': '用户<%苏油条%>在主播<%-猫大人-%>的直播间开通了总督 + # 并触发了抽奖,点击前往TA的房间去抽奖吧', 'url': 'https://live.bilibili.com/77353 + # 93', 'roomid': '7735393'} print(dic) try: - await asyncio.sleep(10) - a = re.compile(r"(?<=在主播 )\S+(?= 的直播间开通了总督)") - res = a.findall(str(dic)) - name = res[0] - roomid = await utils.check_up_name(name) - if roomid == 0: - roomid = await utils.check_up_name(name) - print(roomid) + await asyncio.sleep(10) + roomid = dic['roomid'] response1 = await bilibili().get_giftlist_of_captain(roomid) json_response1 = await response1.json() print(json_response1) @@ -323,6 +322,33 @@ async def parseDanMu(self, messages): payload = {"roomid": roomid, "id": id, "type": "guard", "csrf_token": ''} print(payload) print("获取到房间 %s 的总督奖励: " % (roomid), json_response2) + + # await asyncio.sleep(10) + # a = re.compile(r"(?<=在主播 )\S+(?= 的直播间开通了总督)") + # res = a.findall(str(dic)) + # name = res[0] + # roomid = await utils.check_up_name(name) + # if roomid == 0: + # roomid = await utils.check_up_name(name) + # print(roomid) + # response1 = await bilibili().get_giftlist_of_captain(roomid) + # json_response1 = await response1.json() + # print(json_response1) + # num = len(json_response1['data']['guard']) + # if num == 0: + # await asyncio.sleep(10) + # response1 = await bilibili().get_giftlist_of_captain(roomid) + # json_response1 = await response1.json() + # print(json_response1) + # num = len(json_response1['data']['guard']) + # for i in range(0, num): + # id = json_response1['data']['guard'][i]['id'] + # print(id) + # response2 = await bilibili().get_gift_of_captain(roomid, id) + # json_response2 = await response2.json() + # payload = {"roomid": roomid, "id": id, "type": "guard", "csrf_token": ''} + # print(payload) + # print("获取到房间 %s 的总督奖励: " % (roomid), json_response2) except: Printer().printlist_append(['join_lotter', '', 'user', "没领取到奖励,请联系开发者"]) pass diff --git a/login.py b/login.py index dddf732..3faaddc 100644 --- a/login.py +++ b/login.py @@ -82,13 +82,13 @@ def login(self): True) async def login_new(self): - response = await bilibili().check_activity_exist() - json_res = await response.json() - if json_res['code'] == 0: - activity_name = (list((json_res['data']['eventList'][0]['lottery']['config']).keys()))[0] - bilibili().dic_bilibili['activity_name'] = activity_name - else: - Printer().printlist_append(['join_lottery', '', 'user', "自动查询没有查询到新活动"], True) + # response = await bilibili().check_activity_exist() + # json_res = await response.json() + # if json_res['code'] == 0: + # activity_name = (list((json_res['data']['eventList'][0]['lottery']['config']).keys()))[0] + # bilibili().dic_bilibili['activity_name'] = activity_name + # else: + # Printer().printlist_append(['join_lottery', '', 'user', "自动查询没有查询到新活动"], True) if bilibili().dic_bilibili['saved-session']['cookie']: Printer().printlist_append(['join_lottery', '', 'user', "复用cookie"], True) bilibili().load_session(bilibili().dic_bilibili['saved-session'])