|
@@ -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}")
|