Compare commits

...

2 Commits

Author SHA1 Message Date
余弦 da482ca9f5
Merge pull request #15 from keven1024/master 3 years ago
keven1024 97599602f9
Update ck_bilibili.py 3 years ago
  1. 12
      dailycheckin_scripts/ck_bilibili.py

12
dailycheckin_scripts/ck_bilibili.py

@ -31,7 +31,7 @@ class BiliBili():
@staticmethod @staticmethod
def reward(session) -> dict: def reward(session) -> dict:
"""取B站经验信息""" """取B站经验信息"""
url = "https://account.bilibili.com/home/reward" url = "https://api.bilibili.com/x/member/web/exp/reward"
ret = session.get(url=url).json() ret = session.get(url=url).json()
return ret return ret
@ -257,7 +257,7 @@ class BiliBili():
live_msg = self.live_sign(session=session) live_msg = self.live_sign(session=session)
aid_list = self.get_region(session=session) aid_list = self.get_region(session=session)
reward_ret = self.reward(session=session) reward_ret = self.reward(session=session)
coins_av_count = reward_ret.get("data", {}).get("coins_av") // 10 coins_av_count = reward_ret.get("data", {}).get("coins") // 10
coin_num = coin_num - coins_av_count coin_num = coin_num - coins_av_count
coin_num = coin_num if coin_num < coin else coin coin_num = coin_num if coin_num < coin else coin
if coin_type == 1 and coin_num: if coin_type == 1 and coin_num:
@ -303,10 +303,10 @@ class BiliBili():
live_stats = self.live_status(session=session) live_stats = self.live_status(session=session)
uname, uid, is_login, new_coin, vip_type, new_current_exp = self.get_nav(session=session) uname, uid, is_login, new_coin, vip_type, new_current_exp = self.get_nav(session=session)
reward_ret = self.reward(session=session) reward_ret = self.reward(session=session)
login = reward_ret.get("data", {}).get("login") login = 1 if reward_ret.get("data", {}).get("login") else 0
watch_av = reward_ret.get("data", {}).get("watch_av") watch_av = 1 if reward_ret.get("data", {}).get("watch") else 0
coins_av = reward_ret.get("data", {}).get("coins_av", 0) coins_av = 1 if reward_ret.get("data", {}).get("coins", 0) else 0
share_av = reward_ret.get("data", {}).get("share_av") share_av = 1 if reward_ret.get("data", {}).get("share") else 0
today_exp = len([one for one in [login, watch_av, share_av] if one]) * 5 today_exp = len([one for one in [login, watch_av, share_av] if one]) * 5
today_exp += coins_av today_exp += coins_av
update_data = (28800 - new_current_exp) // (today_exp if today_exp else 1) update_data = (28800 - new_current_exp) // (today_exp if today_exp else 1)

Loading…
Cancel
Save