zhangyong 7 月之前
父节点
当前提交
9af431e050
共有 1 个文件被更改,包括 3 次插入10 次删除
  1. 3 10
      video_processing/video_processing.py

+ 3 - 10
video_processing/video_processing.py

@@ -22,17 +22,10 @@ class VideoProcessing:
         response = requests.request( "POST", url, headers=headers, data=payload )
         try:
             response = response.json()
-            print(response)
             result = response['result']
-            print(result)
-            # 去除不必要的前缀
-            cleaned_string = result.split( 'json\n', '')[-1].strip()
-            # 清除控制字符
-            cleaned_string = re.sub( r'[\x00-\x1F]+', '', cleaned_string )
-            # 打印出清理后的 JSON 字符串以供检查
-            print( "清理后的 JSON 字符串:", cleaned_string )
-            json_data = json.loads( cleaned_string )
-            print(json_data)
+            cleaned_string = result.replace( "```json", "" ).replace( "```", "" ).strip()
+            print(cleaned_string)
+            json_data = json.loads(cleaned_string)
             return json_data
         except Exception as e:
             print(f"视频请求异常:{e}")