    async def acheck_stream(self, is_check=False):
        try:
            if not self.__room_id.isdigit():
                self.__room_id = _get_real_rid(self.url)
            room_profile = await self.get_room_profile(use_api=True)
        except Exception as e:
            logger.error(f"{self.plugin_msg}: {e}")
            return False

        if room_profile['realLiveStatus'] != 'ON' or room_profile['liveStatus'] != 'ON':
            '''
            ON: 直播
            REPLAY: 重播
            OFF: 未开播
            '''
            logger.debug(f"{self.plugin_msg} : 未开播")
            self.raw_stream_url = None
            return False

        if not room_profile['liveData'].get('bitRateInfo'):
            # 主播未推流
            logger.debug(f"{self.plugin_msg} : 未推流")
            return False

        if is_check:
            return True

        if self.huya_max_ratio:
            try:
                self.huya_max_ratio = int(self.huya_max_ratio)
                # 最大码率(不含hdr)
                # max_ratio = html_info['data'][0]['gameLiveInfo']['bitRate']
                max_ratio = room_profile['liveData']['bitRate']
                # 可选择的码率
                live_rate_info = json.loads(room_profile['liveData']['bitRateInfo'])
                # 码率信息
                ratio_items = [r.get('iBitRate', 0) if r.get('iBitRate', 0) != 0 else max_ratio for r in live_rate_info]
                # 符合条件的码率
                ratio_in_items = [x for x in ratio_items if x <= self.huya_max_ratio]
                # 录制码率
                if ratio_in_items:
                    record_ratio = max(ratio_in_items)
                else:
                    record_ratio = max_ratio
            except (json.JSONDecodeError, KeyError) as e:
                logger.error(f"{self.plugin_msg}: 在确定码率时发生错误 {e}")
                return False

        is_xingxiu = room_profile['liveData']['gid'] == 1663

        try:
            stream_urls = await self.get_stream_urls(self.huya_protocol, self.huya_mobile_api, self.huya_imgplus, is_xingxiu)
        except Exception as e:
            logger.error(f"{self.plugin_msg}: 没有可用的链接 {e}")
            return False

        cdn_name = list(stream_urls.keys())
        if not self.huya_cdn or self.huya_cdn not in cdn_name:
            self.huya_cdn = cdn_name[0]

        # 虎牙直播流只允许连接一次
        if self.huya_cdn_fallback:
            _url = await self.acheck_url_healthy(stream_urls[self.huya_cdn])
            if _url is None:
                logger.info(f"{self.plugin_msg}: cdn_fallback 顺序尝试 {cdn_name}")
                for cdn in cdn_name:
                    logger.info(f"{self.plugin_msg}: cdn_fallback-{cdn}")
                    if (await self.acheck_url_healthy(stream_urls[cdn])) is None:
                        continue
                    self.huya_cdn = cdn
                    logger.info(f"{self.plugin_msg}: cdn_fallback 回退到 {self.huya_cdn}")
                    break
                else:
                    logger.error(f"{self.plugin_msg}: cdn_fallback 所有链接无法使用")
                    return False
            stream_urls = await self.get_stream_urls(self.huya_protocol, self.huya_mobile_api, self.huya_imgplus, is_xingxiu)

        self.room_title = room_profile['liveData']['introduction']
        self.raw_stream_url = stream_urls[self.huya_cdn]

        if self.huya_max_ratio and record_ratio != max_ratio:
            self.raw_stream_url += f"&ratio={record_ratio}"
        return True
ON: 直播
REPLAY: 重播
OFF: 未开播
biliup/plugins/huya.py