Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Download quran audio
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