galacticwarrior9 / IslamBot

A Discord bot that supports Qur'an, hadith, prayer times, tafsir and more.
GNU General Public License v3.0
87 stars 36 forks source link

Bridges translation for Quran gives half literal html output #38

Closed itzmk21 closed 2 years ago

itzmk21 commented 2 years ago

E.g <a class='sup'>.... Your...

itzmk21 commented 2 years ago

one of the keys from https://api.quran.com/api/v4/quran/translations/149?verse_key=33:3 is something like "text": "And place your<a class=\"sup\"><sup>sg </sup></a>trust in Allah, for Allah is sufficient as a Trustee."

In the get_verses() method of QuranRequest:

 # Clear HTML tags
clean_footnotes = re.compile('<sup\s+foot_note=\d+>\d+<\/sup>')
text = re.sub(clean_footnotes, '', text)
text = text.replace("<span>", "").replace("</span>", "").replace("<br>", "").replace("</br>", "")

There's this. I'm not sure, what it's doing, whether it's there to solve that specific problem or not. Perhaps this is the part that needs to be fixed.