Skip to content

Commit 84568f2

Browse files
committed
feat: add laixiu live support
1 parent b7fa9bb commit 84568f2

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

app/core/platform_handlers/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
JDHandler,
2121
KuaishouHandler,
2222
KugouHandler,
23+
LaixiuHandler,
2324
LangLiveHandler,
2425
LehaiHandler,
2526
LianJieHandler,
@@ -124,6 +125,7 @@ def get_platform_info(record_url: str) -> tuple:
124125
"faceit.com": ("faceit", "faceit"),
125126
"lailianjie.com": ("连接直播", "lianjie"),
126127
"miguvideo.com": ("咪咕直播", "migu"),
128+
"imkktv.com": ("来秀直播", "laixiu"),
127129
".m3u8": ("自定义录制直播", "custom"),
128130
".flv": ("自定义录制直播", "custom"),
129131
}
@@ -155,6 +157,7 @@ def get_platform_info(record_url: str) -> tuple:
155157
"JDHandler",
156158
"KuaishouHandler",
157159
"KugouHandler",
160+
"LaixiuHandler",
158161
"LangLiveHandler",
159162
"LehaiHandler",
160163
"LianJieHandler",

app/core/platform_handlers/handlers.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,6 +1035,27 @@ async def get_stream_info(self, live_url: str) -> StreamData:
10351035
return await self.live_stream.fetch_stream_url(json_data, self.record_quality)
10361036

10371037

1038+
class LaixiuHandler(PlatformHandler):
1039+
platform = "laixiu"
1040+
1041+
def __init__(
1042+
self,
1043+
proxy: str | None = None,
1044+
cookies: str | None = None,
1045+
record_quality: str | None = None,
1046+
platform: str | None = None,
1047+
) -> None:
1048+
super().__init__(proxy, cookies, record_quality, platform)
1049+
self.live_stream: streamget.LaixiuLiveStream | None = None
1050+
1051+
@trace_error_decorator
1052+
async def get_stream_info(self, live_url: str) -> StreamData:
1053+
if not self.live_stream:
1054+
self.live_stream = streamget.LaixiuLiveStream(proxy_addr=self.proxy, cookies=self.cookies)
1055+
json_data = await self.live_stream.fetch_web_stream_data(url=live_url)
1056+
return await self.live_stream.fetch_stream_url(json_data, self.record_quality)
1057+
1058+
10381059
DouyinHandler.register(r"https://.*\.douyin\.com/")
10391060
TikTokHandler.register(r"https://.*\.tiktok\.com/")
10401061
KuaishouHandler.register(r"https://live\.kuaishou\.com/")
@@ -1083,3 +1104,4 @@ async def get_stream_info(self, live_url: str) -> StreamData:
10831104
FaceitHandler.register(r"https://.*\.faceit\.com/")
10841105
LianJieHandler.register(r"https://.*\.lailianjie\.com/")
10851106
MiguHandler.register(r"https://.*\.miguvideo\.com/")
1107+
LaixiuHandler.register(r"https://.*\.imkktv\.com/")

0 commit comments

Comments
 (0)