-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathquran_audio.py
70 lines (62 loc) · 2.21 KB
/
quran_audio.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import requests
import json
def choose_reciter(reciter):
reciter = reciter.lower()
if reciter == "abdul basit":
return "ar.abdulbasitmurattal"
elif reciter == "abdullah basfar":
return "ar.abdullahbasfar"
elif reciter == "abdurrahmaan as-sudais":
return "ar.abdurrahmaansudais"
elif reciter == "abdul samad":
return "ar.abdulsamad"
elif reciter == "abu bakr ash-shaatree":
return "ar.shaatree"
elif reciter == "ahmed ibn ali al-ajamy":
return "ar.ahmedajamy"
elif reciter == "alafasy":
return "ar.alafasy"
elif reciter == "hani rifai":
return "ar.hanirifai"
elif reciter == "husary":
return "ar.husary"
elif reciter == "husary (mujawwad)":
return "ar.husarymujawwad"
elif reciter == "hudhaify":
return "ar.hudhaify"
elif reciter == "ibrahim akhdar":
return "ar.ibrahimakhbar"
elif reciter == "maher al muaiqly":
return "ar.mahermuaiqly"
elif reciter == "minshawi":
return "ar.minshawi"
elif reciter == "minshawy (mujawwad)":
return "ar.minshawimujawwad"
elif reciter == "muhammad ayyoub":
return "ar.muhammadayyoub"
elif reciter == "muhammad jibreel":
return "ar.muhammadjibreel"
elif reciter == "saood bin ibraaheem ash-shuraym":
return "ar.saoodshuraym"
elif reciter == "ibrahim walk":
return "en.walk"
elif reciter == "fooladvand - hedayatfar":
return "fa.hedayatfarfooladvand"
elif reciter == "parhizgar":
return "ar.parhizgar"
elif reciter == "shamshad ali khan":
return "ur.khan"
elif reciter == "chinese":
return "zh.chinese"
elif reciter == "youssouf leclerc":
return "fr.leclerc"
elif reciter == "ayman sowaid":
return "ar.aymanswoaid"
else:
return "ar.alafasy"
def request_audio(surah, ayah, reciter = "Alafasy"):
reciter = choose_reciter(reciter)
something1 = requests.get(f'https://api.alquran.cloud/ayah/{surah}:{ayah}')
something1 = something1.json()
ayah_number_in_quran = something1['data']['number']
return f'http://cdn.alquran.cloud/media/audio/ayah/{reciter}/{ayah_number_in_quran}'