thousandlemons / English-words-pronunciation-mp3-audio-download

Download the pronunciation mp3 audio for 119,376 unique English words/terms
Apache License 2.0
178 stars 52 forks source link

Download doesn't extract all the words #1

Open malinos opened 7 years ago

malinos commented 7 years ago

Hello - thank you a lot for this code! I've releasied that this code doesn't extract all the 119376 due to the following case: image

(1288/119376) on/off switch Exception in thread Thread-7: Traceback (most recent call last): File "C:\ProgramData\Anaconda3\lib\threading.py", line 916, in _bootstrap_inner self.run() File "", line 18, in run download_mp3(word, url, self.dir_path) File "", line 4, in download_mp3 with open(filename, 'wb') as file: FileNotFoundError: [Errno 2] No such file or directory: 'download/on/off switch.mp3'

Kind regards, AM

thousandlemons commented 7 years ago

Actually this repository was not maintained in the past year so I'm not sure whether the links found last year still work now. I'll try getting some spare time to check it soon.

yura-arab4uk commented 6 years ago

Hi! This code worked with exceptions but when it had reached above 500 words program stopped working, so I changed one of the methods to catch and ignore exceptions and now it works fine:

def download_mp3(word, url, dir_path):
    filename = os.path.join(dir_path, word + MP3_FILENAME_EXTENSION)
    try:
        with open(filename, 'wb') as file:
            file.write(requests.get(url).content)
    except Exception:
        pass

THANKS FOR THIS PROGRAM!!!

yura-arab4uk commented 6 years ago

Some files are corrupted though (