From 966712037ca3dcc761ddb9a37bdb9fd624a0e0c0 Mon Sep 17 00:00:00 2001 From: yawwwwwn <40122222+yawwwwwn@users.noreply.github.com> Date: Sun, 5 May 2019 00:51:10 +0800 Subject: [PATCH] Debug heartbeat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 5 min一次的发送心跳包的api改了,现在需要带csrf --- bilibili.py | 6 +++++- printer.py | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/bilibili.py b/bilibili.py index 8ec76a8..36dd1ae 100644 --- a/bilibili.py +++ b/bilibili.py @@ -359,7 +359,11 @@ async def get_TV_result(self, TV_roomid, TV_raffleid): async def pcpost_heartbeat(self): url = 'https://api.live.bilibili.com/User/userOnlineHeart' - response = await self.bili_section_post(url, headers=self.dic_bilibili['pcheaders']) + data = { + "csrf_token": self.dic_bilibili['csrf'], + "csrf": self.dic_bilibili['csrf'] + } + response = await self.bili_section_post(url, data=data, headers=self.dic_bilibili['pcheaders']) return response # 发送app心跳包 diff --git a/printer.py b/printer.py index 9ee1214..5a52d11 100644 --- a/printer.py +++ b/printer.py @@ -1,6 +1,7 @@ from colorama import init from termcolor import * import time +import os import configloader