Skip to content

Commit 04631f7

Browse files
committed
feat: add changliao live support
1 parent e6f15da commit 04631f7

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

app/core/platform_handlers/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
BigoHandler,
77
BilibiliHandler,
88
BluedHandler,
9+
ChangliaoHandler,
910
ChzzkHandler,
1011
DouyinHandler,
1112
DouyuHandler,
@@ -138,6 +139,7 @@ def get_platform_info(record_url: str) -> tuple:
138139
"BigoHandler",
139140
"BilibiliHandler",
140141
"BluedHandler",
142+
"ChangliaoHandler",
141143
"ChzzkHandler",
142144
"DouyinHandler",
143145
"DouyuHandler",

app/core/platform_handlers/handlers.py

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

659659

660+
class ChangliaoHandler(PlatformHandler):
661+
platform = "changliao"
662+
663+
def __init__(
664+
self,
665+
proxy: str | None = None,
666+
cookies: str | None = None,
667+
record_quality: str | None = None,
668+
platform: str | None = None,
669+
) -> None:
670+
super().__init__(proxy, cookies, record_quality, platform)
671+
self.live_stream: streamget.ChangliaoLiveStream | None = None
672+
673+
@trace_error_decorator
674+
async def get_stream_info(self, live_url: str) -> StreamData:
675+
if not self.live_stream:
676+
self.live_stream = streamget.ChangliaoLiveStream(proxy_addr=self.proxy, cookies=self.cookies)
677+
json_data = await self.live_stream.fetch_web_stream_data(url=live_url)
678+
return await self.live_stream.fetch_stream_url(json_data, self.record_quality)
679+
680+
660681
class ZhihuHandler(PlatformHandler):
661682
platform = "zhihu"
662683

@@ -1023,6 +1044,7 @@ async def get_stream_info(self, live_url: str) -> StreamData:
10231044
AcfunHandler.register(r"live.acfun.cn/")
10241045
InkeHandler.register(r"https://.*\.inke\.cn/")
10251046
YinboHandler.register(r"live.ybw1666.com")
1047+
ChangliaoHandler.register(r".*\.tlclw\.com")
10261048
ZhihuHandler.register(r"https://.*\.zhihu\.com/")
10271049
ChzzkHandler.register(r"chzzk\.naver\.com/")
10281050
HaixiuHandler.register(r"https://.*\.haixiutv\.com/")

0 commit comments

Comments
 (0)