def get_speech(self, phrase):
getinfo_url = 'http://www.peiyinge.com/make/getSynthSign'
voice_baseurl = 'http://proxy.peiyinge.com:17063/synth?ts='
data = {
'content': phrase.encode('utf8')
}
result_info = requests.post(getinfo_url, data=data).json()
content = urllib.quote(phrase.encode('utf8'))
ts = result_info['ts']
sign = result_info['sign']
voice_url = voice_baseurl + ts + '&sign=' + sign + \
'&vid=' + self.vid + '&volume=&speed=0&content=' + content
r = requests.get(voice_url)
with tempfile.NamedTemporaryFile(suffix='.mp3', delete=False) as f:
f.write(r.content)
tmpfile = f.name
return tmpfile
评论列表
文章目录