Today, I made a tool that might be useless for you, and maybe even for me but it is very special for someone. My father has a deep passion for reading books, and discovering a new resource always makes him happy. Rekhta is one such resource but it's kind of a locked one. You can only read books online, there’s no offline support and you can’t print them either.
My father always wanted to read those books, but it's hard for him to stay on a screen for a long time. I searched online, but couldn’t find a way to download books from Rekhta.
Today, I was just inspecting how things work under the hood. Turns out, Rekhta uses a very interesting algorithm. Each page is broken into dozens of small tiles, and when a user opens a page, those tiles are reassembled in the correct order using JavaScript and canvas. If you try to inspect the image, all you see is a mess of shuffled tiles — like a puzzle exploded on the screen.
For each page, Rekhta sends an API request for each page that contains the exact coordinates for placing each tile. So, in simple terms, each page is like a jigsaw puzzle, and the API gives you the map to solve it.
Anyways, I wrote a script that combines everything into a single PDF. Honestly, I did not expect to pull off such a smooth downloader. Long story short, when I showed my father what I made, he was, as expected, very happy.