Inspired by this post and building on some things I have been doing recently, I thought I would see if I could make an ultra-light interface for accessing the root and translation data of SuttaCentral.net without going through the website.
When you go there you will find some brief instruction.
Big caveats:
- it’s up to you to give a correct citation/url
So, that means that if there is a range for a particular sutta, you have to give the correct range. For example ?an1.1
will give you an error. It has to be ?an1.1-10
Is it really only 4kb?
Yes. And you get what you pay for, as you will see. There is no nothin’ except the Pali and English of the sutta and Vinaya. And the 4kb doesn’t count the data of the sutta itself. Just the interface. If you can even call it that.
Well, no. Not any more. It’s still really small. And after the first time you visit the page it should cache everything, so you really will just be downloading a few kb to get the body of the text. The biggest part is now the font, which is a custom subset of Roboto Serif, at ~20kb. I felt that this would give a better reading experience overall. There are also several icons that are less than a kb each. And lots of little interface improvements (including a dark mode) have bumped things up to about 19kb + the font + the actual sutta you want to download. So, yeah, it’s probably smaller than any web page you are going to visit this week. And getting it back down to ~5kb would simply be a matter of pulling out things that aren’t essential.
How does it compare with the real thing?
(This is now out of date. See above)
I’m not 100% confident these numbers are accurate, but I think they give a good idea.
Sutta | real SC size | real SC time | mini size | mini time |
---|---|---|---|---|
DN16 | 1.630 mb | 23.6 sec | .081 mb | 2.6 sec |
SN1.1 | 1.360 mb | 11.6 sec | .008 mb | 1.46 sec |
Now, those numbers are without caching. DN16 on the main site drops down to .817 mb if it is building from cache. Also, I have the Pali-English lookup turned on for the main site, and it appears that that data alone may be over .400 mb in transfer size (it’s over 3mb on disk)
How does it work
The latest version makes use of the SuttaCentral API
The old version (still available as a branch on github)
pulls all the sutta data (Pali and translation) from the raw files on the github repository. So for example, for SN1.1 it is pulling from these three files:
- ~~https://raw.githubusercontent.com/suttacentral/bilara-data/published/root/pli/ms/sutta/sn/sn1/sn1.1_root-pli-ms.json~~
- ~~https://raw.githubusercontent.com/suttacentral/bilara-data/published/translation/en/sujato/sutta/sn/sn1/sn1.1_translation-en-sujato.json~~
- ~~https://raw.githubusercontent.com/suttacentral/bilara-data/published/html/pli/ms/sutta/sn/sn1/sn1.1_html.json~~
code
Here is the github repository:
I’d love to hear any feedback. Obviously there could be a lot more to the interface (like an actual interface!) and still not take up much space.