Seanna语音合成支持

以前在凤巢玩的时候被安利了一发TTS,这两天又看到了,就琢磨着放在Seanna上了。
一直黑百度,但是有的东西百度做得还真不错。

def get_video(self, text, uid):
    url = "http://tsn.baidu.com/text2audio"
    text = urllib.quote(text.encode('utf8'))
    data = {
        'tex':text,
        'lan':'zh',
        'cuid':'C2335EE48C96',
        'ctp':'1',
        'tok':'24.40180bde9494ba22a6ecfefe251f8030.2592000.1487353701.282335-9214410'
    }
    response = urllib.urlopen( url, urllib.urlencode(data) ).read()
    with open( 'video/' + uid + '.mp3', 'wb') as f:
        f.write(response)