diff --git a/danmu/Panda.py b/danmu/Panda.py index be0c27c..44a3353 100644 --- a/danmu/Panda.py +++ b/danmu/Panda.py @@ -29,19 +29,10 @@ def _get_live_status(self): return j['videoinfo']['status'] == '2' def _prepare_env(self): roomId = self.url.split('/')[-1] or self.url.split('/')[-2] - url = 'http://www.panda.tv/ajax_chatroom?roomid=%s&_=%s'%(roomId, str(int(time.time()))) - roomInfo = requests.get(url).json() - url = 'http://api.homer.panda.tv/chatroom/getinfo' - params = { - 'rid': roomInfo['data']['rid'], - 'roomid': roomId, - 'retry': 0, - 'sign': roomInfo['data']['sign'], - 'ts': roomInfo['data']['ts'], - '_': int(time.time()), } - serverInfo = requests.get(url, params).json()['data'] - serverAddress = serverInfo['chat_addr_list'][0].split(':') - return (serverAddress[0], int(serverAddress[1])), serverInfo + url = 'http://www.panda.tv/ajax_chatinfo?roomid=%s&_=%s'%(roomId, str(int(time.time()))) + roomInfo = requests.get(url).json()['data'] + serverAddress = roomInfo['chat_addr_list'][0].split(':') + return (serverAddress[0], int(serverAddress[1])), roomInfo def _init_socket(self, danmu, roomInfo): data = [ ('u', '%s@%s'%(roomInfo['rid'], roomInfo['appid'])), diff --git a/run.py b/run.py index 817ff3d..64a1266 100644 --- a/run.py +++ b/run.py @@ -6,7 +6,7 @@ def pp(msg): print(msg.encode(sys.stdin.encoding, 'ignore'). decode(sys.stdin.encoding)) -dmc = DanMuClient('https://www.douyu.com/32892') +dmc = DanMuClient('https://www.panda.tv/20641') if not dmc.isValid(): print('Url not valid') @dmc.danmu