Skip to content
This repository has been archived by the owner on Jun 6, 2023. It is now read-only.

Commit

Permalink
维护
Browse files Browse the repository at this point in the history
  • Loading branch information
Dawnnnnnn committed Jul 14, 2018
1 parent 8819d53 commit 79f3528
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 22 deletions.
2 changes: 1 addition & 1 deletion OnlineHeart.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
# bilibili-live-tools


项目又经过了一天的重构。差不多能当python课设交上去了(´;ω;`)

学业繁忙,准备弃坑咕咕咕(flag),风暴初版已上传,不再更新后几版

//时隔多日打算学一下图形化,说不定会以这个项目作为样本(flag)

同级项目开坑: https://github.com/Dawnnnnnn/bilibili-tools

开放识别登录验证码接口:
Expand All @@ -23,6 +17,7 @@
双端心跳领取经验
领取银瓜子宝箱
提交每日任务
C位抽奖
摩天大楼全站抽奖
小电视PC端抽奖
领取每日包裹奖励
Expand Down
42 changes: 34 additions & 8 deletions bilibiliCilent.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ async def ReceiveMessageLoop(self):
async def parseDanMu(self, messages):
try:
dic = json.loads(messages)
# print(dic)

except:
return
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down
14 changes: 7 additions & 7 deletions login.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down

0 comments on commit 79f3528

Please sign in to comment.