From d37d9f25ad101d65549589efb751d64cbaae9ffc Mon Sep 17 00:00:00 2001 From: ihmily <114978440+ihmily@users.noreply.github.com> Date: Thu, 5 Jun 2025 14:19:53 +0800 Subject: [PATCH] fix: update maoerfm live record --- main.py | 3 ++- src/spider.py | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index e0a1e66..418f1d6 100644 --- a/main.py +++ b/main.py @@ -655,6 +655,7 @@ def start_record(url_data: tuple, count_variable: int = -1) -> None: with semaphore: port_info = asyncio.run(spider.get_maoerfm_stream_url( url=record_url, proxy_addr=proxy_address, cookies=maoerfm_cookie)) + video_save_type = 'mp3音频' elif record_url.find("www.winktv.co.kr/") > -1: platform = 'WinkTV' @@ -1293,7 +1294,7 @@ def start_record(url_data: tuple, count_variable: int = -1) -> None: elif "音频" in video_save_type: try: now = time.strftime("%Y-%m-%d_%H-%M-%S", time.localtime()) - extension = "mp3" if "MP3" in video_save_type else "m4a" + extension = "mp3" if "MP3" in video_save_type.upper() else "m4a" name_format = "_%03d" if split_video_by_time else "" save_file_path = (f"{full_path}/{anchor_name}_{title_in_name}{now}" f"{name_format}.{extension}") diff --git a/src/spider.py b/src/spider.py index a036902..6ec556d 100644 --- a/src/spider.py +++ b/src/spider.py @@ -1117,6 +1117,8 @@ async def get_pandatv_stream_data(url: str, proxy_addr: OptionalStr = None, cook json_str = await async_req('https://api.pandalive.co.kr/v1/member/bj', proxy_addr=proxy_addr, headers=headers, data=data, abroad=True) json_data = json.loads(json_str) + if "bjInfo" not in json_data: + raise RuntimeError(json_data.get("message", 'Unknown error')) anchor_id = json_data['bjInfo']['id'] anchor_name = f"{json_data['bjInfo']['nick']}-{anchor_id}" result['anchor_name'] = anchor_name @@ -1165,7 +1167,7 @@ async def get_maoerfm_stream_url(url: str, proxy_addr: OptionalStr = None, cooki m3u8_url = stream_list['hls_pull_url'] flv_url = stream_list['flv_pull_url'] title = json_data['info']['room']['name'] - result |= {'is_live': True, 'title': title, 'm3u8_url': m3u8_url, 'flv_url': flv_url, 'record_url': m3u8_url} + result |= {'is_live': True, 'title': title, 'm3u8_url': m3u8_url, 'flv_url': flv_url, 'record_url': flv_url} return result