Simplify addword.py implementation

chore/remove-ads
Yuan Chen 4 years ago
parent e7c7facc62
commit 09ab3e95c1

@ -21,22 +21,6 @@ def main():
line = '| ' + word + ' | ' + britsh_eng + ' | ' + american_eng + ' | ' + ' ' + '|' line = '| ' + word + ' | ' + britsh_eng + ' | ' + american_eng + ' | ' + ' ' + '|'
print(line) print(line)
def get_pronunciation_files(word):
"""Return the word's pronunciation files from youdao.com if available
(British English and American English) as a list"""
word = word.strip()
prons = [" ", " "]
url = "http://dict.youdao.com/dictvoice?audio="+word+"&type=1"
try:
urllib.request.urlopen(url)
prons[0] = url
urllib.request.urlopen(url)
prons[1] = url
except:
return prons
return prons
def get_pronunciations(word): def get_pronunciations(word):
"""Return the word's pronouciation URLs and phonetic transcriptions """Return the word's pronouciation URLs and phonetic transcriptions
from youdao.com if available""" from youdao.com if available"""

Loading…
Cancel
Save