我有此链接:
https : //translate.google.com/translate_tts?ie=UTF-8&client=tw-ob&q=dog&tl=en&total=
1 &idx=0&textlen=3我可以通过右键单击→“保存音频”来手动下载音频为...”,然后将其另存为.mp3。
如何使用Python脚本下载该文件?
此代码应允许您将必需的内容另存为MP3:
import requests
url = 'https://translate.google.com/translate_tts?ie=UTF-8&client=tw-ob&q=dog&tl=en&total=1&idx=0&textlen=3'
response = requests.get(url)
with open('/path/to/file/qwerty.mp3', 'wb') as f:
f.write(response.content)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句