diff --git a/main.py b/main.py index 5055051..678dc07 100644 --- a/main.py +++ b/main.py @@ -4,7 +4,7 @@ Author: Hmily GitHub: https://github.com/ihmily Date: 2023-07-17 23:52:05 -Update: 2024-09-01 21:28:33 +Update: 2024-09-02 23:46:33 Copyright (c) 2023-2024 by Hmily, All Rights Reserved. Function: Record live stream video. """ @@ -1070,10 +1070,6 @@ def start_record(url_data: tuple, count_variable: int = -1): max_muxing_queue_size = "2048" break - if platform == 'PandaTV': - headers = 'origin:https://www.pandalive.co.kr' - else: - headers = '' ffmpeg_command = [ 'ffmpeg', "-y", "-v", "verbose", @@ -1081,7 +1077,6 @@ def start_record(url_data: tuple, count_variable: int = -1): "-loglevel", "error", "-hide_banner", "-user_agent", user_agent, - "-headers", headers, "-protocol_whitelist", "rtmp,crypto,file,http,https,tcp,tls,udp,rtp", "-thread_queue_size", "1024", "-analyzeduration", analyzeduration, @@ -1096,6 +1091,11 @@ def start_record(url_data: tuple, count_variable: int = -1): "-correct_ts_overflow", "1", ] + if platform == 'PandaTV': + headers = 'origin:https://www.pandalive.co.kr' + ffmpeg_command.insert(11, "-headers") + ffmpeg_command.insert(12, headers) + # 添加代理参数 if proxy_address: ffmpeg_command.insert(1, "-http_proxy") @@ -1879,4 +1879,4 @@ while True: first_run = False - time.sleep(3) + time.sleep(3) \ No newline at end of file diff --git a/spider.py b/spider.py index dfaab2d..550dbbb 100644 --- a/spider.py +++ b/spider.py @@ -4,7 +4,7 @@ Author: Hmily GitHub: https://github.com/ihmily Date: 2023-07-15 23:15:00 -Update: 2024-09-01 21:28:33 +Update: 2024-09-02 23:46:33 Copyright (c) 2023 by Hmily, All Rights Reserved. Function: Get live stream data. """ @@ -248,11 +248,12 @@ def get_douyin_stream_data(url: str, proxy_addr: Union[str, None] = None, cookie json_data['anchor_name'] = anchor_name if 'status' in json_data and json_data['status'] == 4: return json_data - + stream_orientation = json_data['stream_url']['stream_orientation'] match_json_str2 = re.findall(r'"(\{\\"common\\":.*?)"]\)