Sora233/bilidynamicpush

api好像变了点东西,需要修改一下才能用

Closed this issue · 1 comments

之前的api请求了一下好像会被拦截,尝试把
check_uid_exsist,get_user_name,和直播状态检查里面的请求链接改成https://api.bilibili.com/x/space/app/index?mid={user_uid}

返回值改成res['data']['info']['name']
直播检查部分变成
for uid in uids: try: header = { 'Referer': 'https://space.bilibili.com/{user_uid}/'.format(user_uid=uid), 'Cookie': bilibiliCookie } resp = await aiorequests.get('https://api.bilibili.com/x/space/app/index?mid={user_id}'.format(user_id=uid), headers=header, timeout=20) res = await resp.json() if res['data']['info']['live']['liveStatus'] == 1 and not room_states[uid]: room_states[uid] = True sendCQCode = [] userName = all_user_name[uid] sendCQCode.append(userName) sendCQCode.append('开播了:\n') sendCQCode.append(res['data']['info']['live']['title']) sendCQCode.append('\n') sendCQCode.append(getImageCqCode(res['data']['info']['live']['cover'])) sendCQCode.append('\n') sendCQCode.append(res['data']['info']['live']['url']) msg = ''.join(sendCQCode) if push_uids[uid][0] == 'all': await broadcast(msg, sv_name='bili-dynamic') else: await broadcast(msg, push_uids[uid]) elif room_states[uid] and res['data']['info']['live']['liveStatus'] == 0: room_states[uid] = False sendCQCode = [] userName = res['data']['info']['name'] sendCQCode.append(userName) sendCQCode.append('下播了') msg = ''.join(sendCQCode) if push_uids[uid][0] == 'all': await broadcast(msg, sv_name='bili-dynamic') else: await broadcast(msg, push_uids[uid]) time.sleep(0.5) except Exception as e: sv.logger.info(f'B站直播检查发生错误 uid={uid}\n' + traceback.format_exc()) sv.logger.info('B站直播状态检查结束') isOnChecking = False

以后貌似可以重新使用了

没事了,貌似是请求太频繁导致的qwq