import requests
import subprocess
url = 'https://api.lolimi.cn/API/yyhc/y.php'
s = input("输入:")
data = {
"msg": s,
"speake": "纳西妲",
"noisew": "0.7",
"sdp": "",
"Length": "1",
"noise": "0.6",
"type": "2",
}
response = requests.get(url, data)
if response.status_code == 200:
with open('output.mp3', 'wb') as f:
f.write(response.content)
# 使用mpg321播放output.mp3文件
subprocess.Popen(['mpg321', 'output.mp3'])
print("播放完毕")
else:
print("请求失败")