Created
April 8, 2019 10:02
-
-
Save petrLorenc/10402b0ee1f650adceac84b5671e295b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import urllib | |
import sys | |
import sounddevice as sd | |
text = "Malá demonstrace hlasu který jde získat z google překladače." | |
encoded_text = urllib.parse.quote(text) | |
url = 'http://translate.google.com/translate_tts?tl=cs&q=' + encoded_text + '&client=tw-ob' | |
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 5.1; rv:23.0) Gecko/20100101 Firefox/23.0'} | |
r = requests.get(url, headers=headers) | |
with open("./ff.wav", "wb") as f: | |
f.write(r.content) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ty říkáš ,rozumněl jsem správně?