diff --git a/app/ui/plugins/twitcasting.tsx b/app/ui/plugins/twitcasting.tsx index 9c331d2..6688023 100644 --- a/app/ui/plugins/twitcasting.tsx +++ b/app/ui/plugins/twitcasting.tsx @@ -23,6 +23,25 @@ const TwitCasting: React.FC = props => { return ( <> + + TwitCasting自选画质,没有选中的画质则会自动选择更低级别清晰度,如更低级别画质依旧没有则选择最清晰的。 + + } + label="画质等级(twitcasting_quality)" + style={{ width: '100%' }} + fieldStyle={{ + alignSelf: 'stretch', + padding: 0, + }} + showClear={true} + > + 高画质(high) + 中画质(medium) + 低画质(low) + = props => { padding: 0, }} /> + + Cookie格式: +
+ tc_id=xxxxxxx; tc_ss=xxxxxxx; + + } + label="TwitCasting Cookie(twitcasting_cookie)" + style={{ width: '100%' }} + fieldStyle={{ + alignSelf: 'stretch', + padding: 0, + }} + /> {stream_info}") + return False + + stream_url = None + quality_levels = ["high", "medium", "low"] + streams = stream_info["tc-hls"]["streams"] + if self.twitcasting_quality: + quality_levels_filter = quality_levels[quality_levels.index(self.twitcasting_quality):] + for quality_level in quality_levels_filter: + if quality_level in streams: + stream_url = streams[quality_level] + break + if not stream_url: + for quality_level in quality_levels: + if quality_level in streams: + stream_url = streams[quality_level] + break + if not stream_url: + stream_url = next(iter(streams.values())) + + if not stream_url: + logger.error(f"{Twitcasting.__name__}: {self.url}: 未查找到直播流 => {stream_info}") + return False + + self.raw_stream_url = stream_url + return True def danmaku_init(self): if self.twitcasting_danmaku: self.danmaku = DanmakuClient(self.url, self.gen_download_filename(), { - 'movie_id': self.movie_id, + 'movie_id': self._movie_id, 'password': self.twitcasting_password, })