Skip to content

Instantly share code, notes, and snippets.

@tejasvi
Created November 19, 2019 15:30
Show Gist options
  • Save tejasvi/c11e7268b7148d1014d3f19ed12c1588 to your computer and use it in GitHub Desktop.
Save tejasvi/c11e7268b7148d1014d3f19ed12c1588 to your computer and use it in GitHub Desktop.
Retrieve Ame pronunciation of words offered by google
import urllib.request
import shutil
...
# Download the file from `url` and save it locally under `file_name`:
with urllib.request.urlopen(url) as response, open(file_name, 'wb') as out_file:
shutil.copyfileobj(response, out_file)
word = "blah"
url = f"https://ssl.gstatic.com/dictionary/static/pronunciation/2019-10-21/audio/{word[:2]}/{word}_en_us_3.mp3"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment