1
0
mirror of https://github.com/wbt5/real-url.git synced 2025-07-27 19:10:32 +08:00

新增映客直播弹幕

This commit is contained in:
wbt5 2020-07-05 09:57:32 +08:00
parent 3f90ae45c9
commit 2f63951d68

View File

@ -9,6 +9,7 @@ from .kuaishou import KuaiShou
from .huomao import HuoMao from .huomao import HuoMao
from .egame import eGame from .egame import eGame
from .huajiao import HuaJiao from .huajiao import HuaJiao
from .inke import Inke
__all__ = ['DanmakuClient'] __all__ = ['DanmakuClient']
@ -32,7 +33,8 @@ class DanmakuClient:
'huomao.com': HuoMao, 'huomao.com': HuoMao,
'kuaishou.com': KuaiShou, 'kuaishou.com': KuaiShou,
'egame.qq.com': eGame, 'egame.qq.com': eGame,
'huajiao.com': HuaJiao}.items(): 'huajiao.com': HuaJiao,
'inke.cn': Inke}.items():
if re.match(r'^(?:http[s]?://)?.*?%s/(.+?)$' % u, url): if re.match(r'^(?:http[s]?://)?.*?%s/(.+?)$' % u, url):
self.__site = s self.__site = s
self.__u = u self.__u = u
@ -84,10 +86,17 @@ class DanmakuClient:
await self.__dm_queue.put(m) await self.__dm_queue.put(m)
count += 1 count += 1
await self.heartbeats() 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): async def start(self):
if self.__u == 'huajiao.com': if self.__u == 'huajiao.com':
await self.init_ws_huajiao() await self.init_ws_huajiao()
elif self.__u == 'inke.cn':
await self.init_ws_inke()
else: else:
await self.init_ws() await self.init_ws()
await asyncio.gather( await asyncio.gather(