Quran API
m3o.com
m3o.com
They also provide metadata for download
https://tanzil.net/docs/Quran_Metadata
If you instead send an http request to antoher server, you are just introducing a pointless dependency in your system. It will make your system generally slower because it will take more time to get answers. There's absolutely no benefit.
Those seem like pretty high costs to me mainly to avoid processing a local database. Especially if someone could wrap the local database with a library that has the same interface as the network API! (That library could stop being maintained, but the failure modes are much narrower than the failure modes of a network service.)
A lot of the comments in this thread are suggesting that an API to search small public data is not a very productive approach compared to having that data present locally in programs that will use it. I can think of lots of advantages that network APIs could have:
* querying nonpublic data (including nonpublic data that the end user is fully entitled to access all of, but doesn't want to cache on a mobile device because of its sensitivity)
* applying a sophisticated algorithm to the data
* offloading computation or storage to a more powerful device
* dealing with frequent updates or edits to the data
* ...
However, none of those seem to apply readily to the case of searching a specific religious or literary text, because downloading the complete text is usually a very practical option. (I guess the "nonpublic data" part could also apply because some of the translations and transliterations and associated information might be under copyright, and the copyright holder might choose to authorize the API but not authorize bulk downloads of the database. That could also be true for modern commentaries and annotations.)
The only other one that comes to mind for me in terms of people's enthusiasm for this API approach (and indeed in the comment I'm replying to) is
* developers are very used to querying web APIs (and don't like writing their own parsers)
That's fair, but I feel like it's best mitigated by having someone develop a reliable library for parsing a particular database or dataset, with a nice API that the developers will be happy with.
To expand on that, here downloading the file is a way of caching the data. Caching invalidation can be tricky, but for something like this it's actually easy, so you can afford all the benefits of a cache.
- type safe clients provided by M3o
- reducing app/webapp/binary space by relying on APIs to get a subset of the content you need
- a web interface to query the data
There are probably a few more, YMMV
Reudcing space? Really? The data is actually very small. Your npm modules take a lot more space. If anything is really cheap and not worth worrying about, it's disk space.
> Type safety is worse for http calls because you literlly have no idea at compile time what the data will be.
We promise we will return data as per API spec ;)
> The data is actually very small
For this particular example, I guess you are right.
Our vision is that all APIs will have uniform clients, docs etc, so in aggregate it will provide a very convenient workflow. So instead of downloading a.json and b.xml and c.yaml (if possible at all due to size) and defining data structures yourself, just import our library and you are good to go.
But as I said, YMMV. If it's not your cup of tea, I understand that too.
Unfortunately, I don't think that an assumption about the data that's returned from a web API based on a developer's statement on an online forum is really what's meant by "type safety". :-)
ok sure, but that does not mean that "type safety" is an advantage of using your API.
Even though I don't think that the Quran API will benefit many applications, you could probably envision some, like very tiny embedded systems that don't have even megabytes of spare local storage (but do have some kind of user interface).
Here's a list of electronic text resources for the Christian Bible
of which (surprisingly to me) many are also APIs rather than downloads. But there are lots of downloads like XML and text files. One that I found of the King James Version translation has lines like
Gen|4|26| And to Seth, to him also there was born a son; and he called his name Enos: then began men to call upon the name of the LORD.~
i.e. book of Genesis, chapter 4, verse 26, followed by an ASCII string of that verse.
The Quran download mentioned in the grandparent comment at
includes text files with lines like
2|150|ﻮَﻤِﻧْ ﺢَﻴْﺛُ ﺥَﺮَﺠْﺗَ ﻑَﻮَﻟِّ ﻮَﺠْﻬَﻛَ ﺶَﻃْﺭَ ﺎﻠْﻤَﺴْﺟِﺩِ ﺎﻠْﺣَﺭَﺎﻣِ ۚ ﻮَﺤَﻴْﺛُ ﻡَﺍ ﻚُﻨﺘُﻣْ ﻑَﻮَﻟُّﻭﺍ ﻮُﺟُﻮﻬَﻜُﻣْ ﺶَﻃْﺮَﻫُ ﻞِﺌَﻟَّﺍ ﻲَﻛُﻮﻧَ ﻞِﻠﻧَّﺎﺳِ ﻊَﻠَﻴْﻜُﻣْ ﺢُﺟَّﺓٌ ﺈِﻟَّﺍ ﺎﻟَّﺬِﻴﻧَ ﻆَﻠَﻣُﻭﺍ ﻢِﻨْﻬُﻣْ ﻒَﻟَﺍ ﺖَﺨْﺷَﻮْﻬُﻣْ ﻭَﺎﺨْﺷَﻮْﻨِﻳ ﻮَﻟِﺄُﺘِﻣَّ ﻦِﻌْﻤَﺘِﻳ ﻊَﻠَﻴْﻜُﻣْ ﻮَﻠَﻌَﻠَّﻜُﻣْ ﺖَﻬْﺗَﺩُﻮﻧَ
i.e. surah 2, ayah 150, followed by a Unicode string of the text of that ayah. (There's no "book" field because of the sufficiency of the surah numbers.) This file is about 1.3 megabytes uncompressed, although of course it doesn't include additional data that a user might want to have presented (the transliterations or translations mentioned elsewhere in this thread, for example).
There are probably lots of mobile apps that have graphics files alone that are larger than this 1.3 megabyte Quran text file. (Not that mobile apps are the only application for the APIs or anything.)
Another online text at
https://www.sacred-texts.com/isl/htq/index.htm
gives each surah in a separate file (less convenient for downloading, although you could still do it in a few minutes!), so that ayah is
150 وَمِنْ حَيْثُ خَرَجْتَ فَوَلِّ وَجْهَكَ شَطْرَ ٱلْمَسْجِدِ ٱلْحَرَامِ ۚ وَحَيْثُ مَا كُنتُمْ فَوَلُّوا۟ وُجُوهَكُمْ شَطْرَهُۥ لِئَلَّا يَكُونَ لِلنَّاسِ عَلَيْكُمْ حُجَّةٌ إِلَّا ٱلَّذِينَ ظَلَمُوا۟ مِنْهُمْ فَلَا تَخْشَوْهُمْ وَٱخْشَوْنِى وَلِأُتِمَّ نِعْمَتِى عَلَيْكُمْ وَلَعَلَّكُمْ تَهْتَدُونَ
There's some kind of Unicode issue where the letters in the second version seem to be connecting better (e.g. مَا rather than ﻡَﺍ), but my knowledge of Arabic isn't enough to make it obvious to me whether the second one is a more correct encoding or the first one is just making more assumptions about the rendering or something.
Heck, sacred-texts.com will sell you a Flash drive with a huge chunk of their collection on it: https://sacred-texts.com/cdshop/dvd90/index.htm
It's all of four gigabytes. Once that was a lot. Now it's nothing. Every holy text from antiquity, in something the size of your thumb.
I cannot access the tanzil XML file right now due to MobileSafari layout issues (boo). https://github.com/ceefour/qurandatabase has its own consistent DTD, but I doubt this is the only format I will find.
Don’t think it’s possible? There are 114 suras. The longest one is like the screenplay of Star Wars, something many of know by heart even if we can’t recite it. The smallest bunch of suras resemble song lyrics. Most people have memorized considerably more than 114 songs. Replaying them just requires the right stimulus.
{"chapter":1}
instead of ?chapter=1 in the URL. Just something I've noticed in a lot of APIs recently.A curiosity to be sure, and by no means a critical problem.
EDIT: added some commas to help with parsing since I have my phrasing all turned about.
A GET request with a `?chapter=1` argument is more correct than POST because then it's cacheable by browsers, proxies or middleware clients, and thus respects the spirit of the HTTP protocol.
Only if the Qur'an is immutable, that is.
For this usecase a ?chapter=1 query string would have been better and not at all less "RESTy".
Sometimes the "point" is because it can be done. Sometimes the point is someone wants to learn about building an API and would prefer to do it with the Quran rather than with movie quotes.
Then it should be phrased like that. It's obvious the original comment was phrased as a condescending question, especially since they tried to answer it themselves.
There's a difference between genuine interest and trying to show off how smart you are.
Oh, I think everyone was confused because there was no serious technical critique. You made a flippant comment about disk space and network latency. Basic observations that anyone building this would have considered.
You can see from all the comments that everyone viewed you as condescending and unhelpful. You might want to revisit your writing style, since your intentions are not clear to anyone.
you are an unpleasant person to talk with
I'm glad you picked up on my tone. I'd suggest not writing pointless criticism.
Them: "Hey, we wanted to build an API!" You: "What if you don't build an API, and just download a file? That's the same right?"
You must be a joy to peer review at work.
"I wanted to build a fun, cool project." Is a perfectly valid answer.
I think there is value in people critiquing methods and designs for various systems. If I were building some new project I would want my peers to give me honest critique and constructive probing. I make mistakes all the time and would never learn from those mistakes if others didn't point them out to me.
> "liabd 1 hour ago [–] This is awesome and will enable a whole suite of apps to be build on top of it. Great work"
So even in this thread people are discussing adding this service as a dependency to their own applications. I think if you are building a project for yourself for fun that is one thing... but If you advertise it for public use, criticism is perfectly valid, and should be expected.
ESV has a pretty decent API, actually! https://api.esv.org/ I used it way back when when Google TV was a thing, to make a verse-display used during bible studies.
Beyond that, it seems like this could be used as a base for adding new translations, commenting and conversation on particular verses, personal collections of scripture, etc. If you are planning on going in any of those directions you need to build a platform for the static stuff before you expand.
There's plenty of formats they don't involve SQL. It could easily be JSON or XML or YAML or anything else. SQLite is built into Python, you just need to open the file and query it, no importing needed.
If you did use their resources, please cite/reference them :)
But I want to highlight something from a comment of mine further down: while looking for examples of downloadable sacred texts, I found this page
which has -- alongside downloads -- a whole bunch of actively-maintained APIs for Christian Bible verse access, some of them run by pretty prominent organizations.
So, all of our intuitions about the merits of downloading sacred texts to bundle with apps are, apparently, not entirely shared by other developers. :-)
It would be quite interesting if all the world religions’ and philosophies’ texts could be hosted with a common format and available with an API for linking and finding parallels etc.
Maybe then run it all though GPT-3 and generate a new ideology – perhaps a bit scary as to what will come out!
One thing which ancient texts require that modern ones don’t is this: there are a lot of commentaries written about these texts. They’re crucial for understanding the original text. In fact in the Arab world commentaries on Greek and other books were sometimes as valuable as the originals. Commentaries on commentaries were common.
In the west we treat the original as sacred and everything else as secondary.
A real value for an API on a sacred text is to capture all the commentary around it, and let people upload the present say contexts in which they understand it. That would be one way to “understand” a text.
That would be a crowd-sourced encyclopedia of hermeneutics.
Call it Wikineutics.
Good attempt!
And you will get the same answer from any of the multitude of non-Muslim professors in Islamic Studies faculties from universities throughout the non-Muslim world.
And in other news, no - the world is NOT flat. That myth was also debunked, long ago.
Mods - this is a blatent attempt to drag what is an interesting thread into the realm of Islamophobia and the resultant mud slinging that comes with it. Isn't there anything you can do to nip this sort of nonsense in the bud?
https://yaqeeninstitute.org/read/paper/the-origins-of-the-va...
Disclaimer: I am one of the contributors of the site.
In fact, an API that allows access to a religious text should be useful for everyone - even those detractors of said religion.
Next up, we need a legal code API and versioning.
Also maybe this is it? Haven't checked. https://eur-lex.europa.eu/content/help/webservice.html
Yeah you could just download the Quran and reference it locally or someone could (relatively) easily roll their own version of this, but I think something like this is nice and I can appreciate it's value, even if Islam isn't my cup of tea.
[edited for clarity]
agree 100% on legal code versioning - legislation should be a version control diff with 'git blame' like things for contributors ..
https://quranx.com/5.82?Context=3
> Thou wilt find the most vehement of mankind in hostility to those who believe (to be) the Jews and the idolaters.
https://quranx.com/2.65?Context=3
> And ye know of those of you who broke the Sabbath, how We said unto them: Be ye apes, despised and hated!
https://quranx.com/98.6?Context=3
> Those who reject (Truth), among the People of the Book and among the Polytheists, will be in Hell-Fire, to dwell therein (for aye). They are the worst of creatures.
https://quranx.com/5.51?Context=3
> O ye who believe! take not the Jews and the Christians for your friends and protectors: They are but friends and protectors to each other. And he amongst you that turns to them (for friendship) is of them. Verily Allah guideth not a people unjust.
(I do support all efforts to make this publicly available.)
Yes, you can mine around pretty much any holy book and produce quotes that say anything. If I recall, the bible has some passage about rabbits 'chewing the cud', as well as other absurdities. You'll find no recognized denominational Christian who practices rules derived from this though. In fact, you will notice practice even dictated by the Vatican deviates from the content of the Bible frequently as well.
In Islam, the practice I'm talking about is accepted to the point of being codified in their marriage law: https://www.perseus.tufts.edu/hopper/text?doc=Perseus%3Atext...
Section specifically allows marriage to unbelievers. Islamic scholars have expanded this into practice which allows marriage between People of the Book.
You're also misconstruing my point in the least charitable way, and in the process implying that all Pakistani Muslims are extremists. I'm sure you see the problem with that. The only reason I brought up my family is that you stated very clearly that by being from Islamabad, and being an ex-Muslim you could not learn anything from me about Islam, with the implication being that I'm therefore ignorant since I lack the same experience.
All I have been trying to suggest is that the violence you are seeing is from a violent minority, who do not reflect the values of all. On top of that, I'm suggesting that the majority follow a different view of the issue that the extremists you're talking about. Which is a fact. Your argument is equivalent to saying that the Irish Christian terrorists mean that Christians hate Protestants. This is false, a small and violent minority do. To say it does would be cherry picking. No matter how many Northern Irish folks tell me until they are blue in the face that it is representative of all Christians, it will not make it true.
On top of that, you're veering into flame-war/abusive territory here. I'd suggest you review the HN guidelines, since your comments are getting less constructive each time: https://news.ycombinator.com/newsguidelines.html
Your flamewar accusation is nonsense.
I see the disconnect. I agree that they say everyone else are infidels, however there's some infidels who are more acceptable than others. My understanding has always been that the sentiment is a lot closer to "these infidels are so close to the truth!". Or, at least, close enough to allow marriage and coexistence. This point was intended to counter the comment that religions say others unilaterally wrong. In this case, there's some acceptance that the others are 'on the right track'.
The outcome of that will also be telling of whether or not you're being truthful of your quantitative experience of the Quran.
There's at least 6,236 verses of the Quran. Get tagging, make it an open source project, I'll contribute.
Since you seem to be acquainted, can you list them and tell us what makes them vastly different from each other?
> (was illiterate and had to pass it on orally)
What are your sources for the claim that the Prophet Muhammad was illiterate? He's described as al-Nabi al-Ummi [1], an "unlettered" Prophet, meaning unacquainted with the scriptures. Sahih al-Bukhari 114 describes the Prophet[2] as literate.
[1]https://www.oxfordreference.com/view/10.1093/oi/authority.20... [2]https://sunnah.com/bukhari:114
As a follow up suggestion, why do you not start with the Quran you already read as per your statement:
> (I'd know, I've read the entire 600 pages at least 10 times).
Here you mentioned a singular Quran, ie. you were not impeded by "multiple versions" to come to your conclusion that 90% of the Quran is what you say it is... so you already know where to start.
The real irony is the one accusing hate after himself spreading hate and falsehood, while not justifying or proving any of his claims.
And as if pointing out polemical characteristics is the same as writing hate…
Don’t bother with another response if you aren’t going to focus on backing up all that you’ve said.
Of course, you and I both know you have no choice but to flee from this because there’s nothing for you to justify.
I don't really want to shit on any particular religion, so I'll just say that what you've written does not apply to most religious people. Most religions have a live-and-let-live attitude when it comes to other people's religious beliefs.
I think all religions are probably wrong, as far as their metaphysical hypotheses go. By the same logic, that should actually be more offensive than thinking that N - 1 are religions are wrong, not less. (I don't personally see how either is offensive, to be clear.)
For example, most real-world Christians and Muslims are highly tolerant of unbelievers in their everyday lives, but that is not what their books say.
This does not apply to monotheistic faiths. The first problem is that they claim that their god is the only god. The second problem is that they prescribe punishments (death, eternal hellfire etc) for those who do not accept their god. True believers then go out and implement these policies making liberal use of both the carrot and the sword. This has been observed everywhere from ancient Egypt under the rule of Amenhotep IV to modern religions like communism where persecution of other religions is almost a given.[1]
No, your "second problem" does not apply to all monotheistic faiths.
https://en.wikipedia.org/wiki/Henotheism
https://en.wikipedia.org/wiki/Monolatry
(although there are probably religious traditions that don't have an explicit view or doctrine about some of these questions, so they might be hard to classify in this framework)
I'm not sure that I disagree. But I'm not sure that I agree, either. I'm going to have to think about it. (This is about the highest compliment that you can pay to an HN comment.)
Somewhat related. According to Primo Levi (a famous holocaust survivor), there were two classes of people who stood up well in the hell of Auschwitz. One was religious people such as Yahweh's Witnesses, and another was ... Marxists.
Levi totally got lost for words when, shortly after being liberated by Russian army, he chatted with a fellow French prisoner about how lucky they were to survive the Nazi camp, and they did so by only a slight twist of fate, and got a surprising reply: "... but Joseph was there!"
Of course, the French man was talking about Joseph Stalin. He never lost his faith in the camp.
You've completely misconstrued the nature of tolerance.
First, the only valid reason to hold to any religious faith is that you are convinced that it is true. Period. This isn't a narrative among many that you can pretend to believe because it adds structure to your life or some other benefit. You believe it primarily because you think it's true. (The benefits are secondary, though you would expect them if you've got truth. Truth allows you to live in conformity with reality and your own nature and thus your own good.)
Second, you have completely misconstrued what Abrahamic religions believe w.r.t. God. God is not comparable to pagan gods. Pagan gods are just more powerful beings. Each pagan god is just one being among many. That is not the case for the Abrahamic religions, certainly not Christianity and definitive not Catholic understanding. God is the Ipsum Esse Subsistens or subsisting Being Itself. Jesus is the Logos, not some guy competing for marketshare with other gods. This sort of monotheism isn't the reduction of the pantheon to one god. It is the definitive abolishment of the superstition of pagan religion. You actually don't need to appeal to any of these religious faiths to arrive at God thus understood. All you need is metaphysics.
Third, the claim that a lack of faith in God is sure to lead you to hell has nothing to do with intolerance. That's like saying that anyone who claims that driving off a cliff will kill you or taking drugs will destroy your life is an intolerant person engaging in fearmongering to control people and keep them from having fun. If you were headed toward a cliff, or about to shoot up some heroin, wouldn't you want someone to tell you that you'd about to ruin your life or kill yourself? If someone believes that a lack of faith will lead to your eternal damnation, then it is rather a sign of charity and love that they should let you know you're in danger, even if they're wrong. You can appreciate the concern at the least. You seem to be suggesting the absurd idea that it is intolerant to be certain of your beliefs and thus certain that someone else is in error. That's preposterous. What's intolerant is this definition that requires people to artificially deny their certainties and "tone it down" because their beliefs make some people feel uncomfortable for some weird reason. Mind you, believing a lack of faith is a path to hell does not imply forcing people to accept that faith. The Catholic and Christian tradition recognizes the need to evangelize, but not the legitimacy of coercion. Coercion doesn't even make sense since free assent is necessary for faith to be authentic anyway. All you'd get are people pretending to believe to avoid unwelcome consequences, and that's pointless and would constitute fraud at best (for which they might not be culpable if the coercion were severe enough). And FWIW Catholic tradition as far as I know is more or less consistent in at least suspecting that most CATHOLICS probably end up in hell.
I look at tolerance in practical terms. What the religious texts say, or how scholars interpret those texts is irrelevant. The only thing that matters is real world actions.
If the true believers of a religion have consistently punished people for apostasy, or indulged in forced conversions of conquered peoples, or placed restrictions on the practice of other religions, then I don't consider that religion (or its practitioners) to be tolerant.
> you have completely misconstrued what Abrahamic religions believe w.r.t. God.
I would rather say that my statement is redundant. But "the first problem is that monotheists are monotheistic" sounds absurd. Still, at least the Quran makes a distinction between the God of the Quran (Allah) and any other god (ilaah) when it claims that "there is no god but Allah."
> a lack of faith in God is sure to lead you to hell has nothing to do with intolerance. [...] You seem to be suggesting the absurd idea that it is intolerant to be certain of your beliefs and thus certain that someone else is in error.
If this principle limited itself to words and not deeds, I would probably agree. My issue is with the "carrot and the sword" part. That is intolerance manifesting in physical form. And there are hundreds of millions of people who have borne the brunt of this intolerance over the last few thousands years.
Nice ideas, but they are not reflected in actual actions taken by Christians over the course of history (same goes for most religions and related ideas). Theorycrafting about >1000 year old stories didn't help the Cathars or the Sephardim much, and it isn't going to help anyone in any real religious conflict nowadays either.
Based on how many religions and sects of these religions out there, it is entirely unfeasible to have that as a criteria for anything. Human knowledge/text no matter what it contains could have APIs just fine.
In fact, the memory usage required to establish a few TLS sessions might even be greater than the size of the full dataset.
I could ask the same for other holy texts, I guess.
https://news.ycombinator.com/item?id=28595832
If you don't want to be banned, you're welcome to email hn@ycombinator.com and give us reason to believe that you'll follow the rules in the future. They're here: https://news.ycombinator.com/newsguidelines.html.
So English via API doesn't satisfy that.
Can you explain how I'd make calls from a frontend to a PDF? I'd like to include various search terms, and then get back well-structured data.
Is this something PDF's recently started supporting?