Created
March 11, 2020 04:47
-
-
Save suhailvs/6ca882c7a3677713a0f6ee66978bebb7 to your computer and use it in GitHub Desktop.
Download quran audio
This file contains hidden or 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 urllib.request | |
import os | |
from xml.dom.minidom import parse, parseString | |
def download(sura, ayas): | |
print(sura) | |
for aya in range(1, ayas+1): | |
fname = f'{sura:03}{aya:03}.mp3' | |
if not os.path.isfile(fname): | |
url = f'http://www.everyayah.com/data/Hudhaify_128kbps/{sura:03}{aya:03}.mp3' | |
urllib.request.urlretrieve(url, fname) | |
if __name__=='__main__': | |
d = parse('quran-data.xml') | |
suras = d.getElementsByTagName('sura') | |
for s in suras: | |
sura = int(s.getAttribute('index')) | |
ayas = int(s.getAttribute('ayas')) | |
download(sura, ayas) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment