This post is also available in Urdu here.
Rekhta Reader & Downloader
Requirements
Before using this tool, you must install a CORS bypass extension in your browser.
Download the extension here. I have included the complete usage instructions again near the end of this article, so if anything feels unclear, you will find a detailed guide there as well.
You can also see the complete workflow in the diagram below. ( Full-size image )
Extension page for reference:
When the extension is active, its logo appears in color. If it turns black, the extension is disabled.
Back to the tool itself.
Paste the URL of a book into the first field and click GO. The book pages will immediately open inside the reader for browsing and reading.
Search Books Directly — No Need to Visit Rekhta Separately
You can search Rekhta's book collection directly from within the application.
As you can see, the search results appear right inside the tool. Simply click the book you want to open and close the dialog window afterwards.
Click on any page image and start reading. This lets you browse a book before committing to downloading the whole thing — which may save some of us from downloading a dozen books simply because they looked interesting.
Clicking the PDF button downloads the entire book.
I will repeat the usage instructions again near the end of this article, though the screenshots above should already make things fairly self-explanatory.
Before that, however, it might be worth explaining how this tool came into existence in the first place.
The Story Behind This Tool (and a Few Dry Technical Details)
- It still had to be run from the command line. There was a graphical interface at one point, but it never really worked properly.
- It only worked on a computer. So whenever a book was needed, the routine was always the same: open the laptop first, then download the book.
- There was no reading facility. One had to download books blindly. And before downloading a dozen books out of sheer curiosity, it is usually nice to know whether a book is actually worth reading in the first place.
The original plan was to package the entire JavaScript library as an NPM package. Partly because it would be useful, and partly because it seemed like a good opportunity to gain some experience in that area as well.
Then, as often happens with side projects, life intervened and the idea quietly slipped out of mind.
I remember mentioning it to Umar Bhai during a private conversation on Mahfil. A few months later the idea resurfaced, so naturally I opened Mahfil again and started digging through the old discussion threads to refresh my memory and reconstruct the project's history.
Eventually I landed on Muhammad Umar Bhai's GitHub profile and discovered that he had already published a JavaScript version of the tool.
Suffice it to say, I sat there feeling slightly defeated.
(For the record, the Windows version of this tool still exists and continues to work perfectly well. The only catch is that it has no graphical user interface. Think of it as a traditional command-line application that you run through Command Prompt. Not particularly difficult, but an interface certainly makes life easier.)
Then fate decided to intervene.
Looking back at that old codebase sparked a new idea: why not port the entire thing to the frontend and make it work directly as a web application? If successful, everything could happen inside the browser without requiring users to install or run anything complicated.
There was, however, one obstacle.
Browser security policies generally do not allow one website to freely interact with another website's resources. In technical terms, the browser gets quite protective and starts throwing what developers lovingly call CORS errors.
To work around that limitation, I considered two possible solutions and built support for both into the web application.
-
Proxy Backend
The first approach was to use a proxy backend. In simple terms, a backend service fetches the data on your behalf and returns the response to the application. Since the browser sees the request as originating from your own backend, it usually has no reason to object. In theory, this should solve the problem quite neatly. For the sake of accuracy, I should mention that I never fully tested this route in production. My expectation is that it should work, but because the real challenge involves loading images rather than ordinary API responses, there is always the possibility of running into the same CORS restrictions further down the chain. Which brings us to the second and far simpler workaround... -
CORS Bypass Extension
This is by far the easiest solution. Browser extensions exist specifically for bypassing CORS restrictions, and several of them are freely available. Install one, enable it when needed, and the application can access the resources it requires. The extension linked in this article is the one I have been using myself.
As inelegant as browser workarounds sometimes feel, they have one undeniable advantage: they save everyone from setting up servers, configuring proxies, maintaining infrastructure, and generally turning a simple reading tool into a full-time engineering project.
In the end, the goal was not to build a monument to software architecture. The goal was much simpler:
Open a book. Read a book. Download a book if you want.
Preferably from a phone while lying comfortably on a sofa.
How to Use the Tool
-
Install a CORS bypass extension.
Download it here
.
If you intend to use the tool on Android, make sure you are using a browser that supports extensions. One such browser is Kiwi Browser. Kiwi Browser for Android You can download the APK from the Assets section of the release page, or obtain it from any other trusted source you prefer. - Open the Rekhta Reader web application. Rekhta Reader (https://tools.shakeeb.in/rekhta-reader/)
- Enable the extension and start using the web application.
If you run into any issues, feel free to leave a comment below. Suggestions and feedback are equally welcome.
These days I find myself reading most books directly inside the tool, and rarely need to download them anymore. On mobile, however, I still download books occasionally simply because the reading experience is sometimes more comfortable that way.
What Comes Next?
This is not my first Rekhta-related project.
Some time ago I released another tool for Rekhta content in the form of a script and an Android application.
Related blog post:
dRekhta – Rekhta Content Scraper for Android (Release)
That project was designed for text content rather than books.
Now that the books side of the equation has been sorted out as well, the plan is to merge the text-focused tool into this same online platform.
The idea is simple: instead of maintaining separate tools for separate tasks, everything should live under one roof.
Once that happens, you will be able to browse and download Rekhta's poetry, short stories, prose content, and books from a single portal.
One search box, one interface, and hopefully a lot less jumping between websites.
Whether I can stop myself from adding even more features after that remains an entirely different question.
