From 2f63951d683fbe1c240472acb0b41c71e50bd6e2 Mon Sep 17 00:00:00 2001 From: wbt5 Date: Sun, 5 Jul 2020 09:57:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=98=A0=E5=AE=A2=E7=9B=B4?= =?UTF-8?q?=E6=92=AD=E5=BC=B9=E5=B9=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- danmu/danmaku/__init__.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/danmu/danmaku/__init__.py b/danmu/danmaku/__init__.py index 41d17c6..72813e1 100644 --- a/danmu/danmaku/__init__.py +++ b/danmu/danmaku/__init__.py @@ -9,6 +9,7 @@ from .kuaishou import KuaiShou from .huomao import HuoMao from .egame import eGame from .huajiao import HuaJiao +from .inke import Inke __all__ = ['DanmakuClient'] @@ -32,7 +33,8 @@ class DanmakuClient: 'huomao.com': HuoMao, 'kuaishou.com': KuaiShou, 'egame.qq.com': eGame, - 'huajiao.com': HuaJiao}.items(): + 'huajiao.com': HuaJiao, + 'inke.cn': Inke}.items(): if re.match(r'^(?:http[s]?://)?.*?%s/(.+?)$' % u, url): self.__site = s self.__u = u @@ -84,10 +86,17 @@ class DanmakuClient: await self.__dm_queue.put(m) count += 1 await self.heartbeats() + + async def init_ws_inke(self): + ws_url = await self.__site.get_ws_info(self.__url) + self.__ws = await self.__hs.ws_connect(ws_url) + await self.fetch_danmaku() async def start(self): if self.__u == 'huajiao.com': await self.init_ws_huajiao() + elif self.__u == 'inke.cn': + await self.init_ws_inke() else: await self.init_ws() await asyncio.gather(