islamic-network / api.alquran.cloud

The AlQuran.Cloud API - https://alquran.cloud/api
GNU General Public License v3.0
226 stars 41 forks source link

add Hizbqurater of the juz itself #79

Open AbdelrhmanUZaki opened 11 months ago

AbdelrhmanUZaki commented 11 months ago

I tried to get the number of rub in any juz, but api didn't get that info, so I tried a lot and found this equation, so you can use it to add this addition info to the api in json.

You could try above code with this simple python script

juz = int(input("input juz rank: "))
rub_rank = int(input("input rub rank in entire quran: "))
Rank_in_Juz = (rub_rank - ((juz - 1) * 8))
print(Rank_in_Juz)
x = input("press any button to exit")
meezaan commented 11 months ago

I tried to get the number of rub in any juz, but api didn't get that info, so I tried a lot and found this equation, so you can use it to add this addition info to the api in json.

"data": {
        "number": 65,
        "ayahs": [
            {
                "number": 1042,
                "text": "۞ قال الملأ الذين استكبروا من قومه لنخرجنك يا شعيب والذين آمنوا معك من قريتنا أو لتعودن في ملتنا ۚ قال أولو كنا كارهين",
                "surah": {
                    "number": 7,
                    "name": "سُورَةُ الأَعۡرَافِ",
                    "englishName": "Al-A'raaf",
                    "englishNameTranslation": "The Heights",
                    "revelationType": "Meccan",
                    "numberOfAyahs": 206
                },
                "numberInSurah": 88,
                "juz": 9,
                "manzil": 2,
                "page": 162,
                "ruku": 132,
                "hizbQuarter": 65,
                "sajda": false
            },

Its number in entire quran is 65 as shown in "hizbQuarter": 65 To get its number in its juz, do this equation

Rank_in_Juz = (hizbQuarter - ((juz - 1) * 8))
Rank_in_Juz = (65 - ((9 - 1) * 8))
print(Rank_in_Juz)
  • minus 1 => to get number fo juzs before current juz.
  • mult in 8 => to get all rub count before our juz
  • then we will subtract it from hizbQuarter, which will give us its order only in current juz

You could try above code with this simple python script

juz = int(input("input juz rank: "))
rub_rank = int(input("input rub rank in entire quran: "))
Rank_in_Juz = (rub_rank - ((juz - 1) * 8))
print(Rank_in_Juz)
x = input("press any button to exit")

I will have a look, but https://api.alquran.cloud/v1/meta might be useful.

AbdelrhmanUZaki commented 11 months ago

I tried to get the number of rub in any juz, but api didn't get that info, so I tried a lot and found this equation, so you can use it to add this addition info to the api in json.

"data": {
        "number": 65,
        "ayahs": [
            {
                "number": 1042,
                "text": "۞ قال الملأ الذين استكبروا من قومه لنخرجنك يا شعيب والذين آمنوا معك من قريتنا أو لتعودن في ملتنا ۚ قال أولو كنا كارهين",
                "surah": {
                    "number": 7,
                    "name": "سُورَةُ الأَعۡرَافِ",
                    "englishName": "Al-A'raaf",
                    "englishNameTranslation": "The Heights",
                    "revelationType": "Meccan",
                    "numberOfAyahs": 206
                },
                "numberInSurah": 88,
                "juz": 9,
                "manzil": 2,
                "page": 162,
                "ruku": 132,
                "hizbQuarter": 65,
                "sajda": false
            },

Its number in entire quran is 65 as shown in "hizbQuarter": 65 To get its number in its juz, do this equation

Rank_in_Juz = (hizbQuarter - ((juz - 1) * 8))
Rank_in_Juz = (65 - ((9 - 1) * 8))
print(Rank_in_Juz)
  • minus 1 => to get number fo juzs before current juz.
  • mult in 8 => to get all rub count before our juz
  • then we will subtract it from hizbQuarter, which will give us its order only in current juz

You could try above code with this simple python script

juz = int(input("input juz rank: "))
rub_rank = int(input("input rub rank in entire quran: "))
Rank_in_Juz = (rub_rank - ((juz - 1) * 8))
print(Rank_in_Juz)
x = input("press any button to exit")

I will have a look, but https://api.alquran.cloud/v1/meta might be useful.

mmm, NO I didn't find it useful -the meta url you provided but which one I get required data is https://[api.alquran.cloud/v1/hizbQuarter/65/quran-uthmani](https://api.alquran.cloud/v1/hizbQuarter/65/quran-uthmani), which is fine till now. Allah bless you