This is a simple .NET 8 console application that scrapes MCQs from different online sources and consolidates them into a single SQLite DB. Check the schema of the table in the attached picture below.
Currently, it only collects Civil Engineering-related questions from IndiaBix for a select few categories, but this can be extended to other sources as well.
The program itself is pretty brittle in its current state - no allowance has been made for exceptions that I didn't encounter during development. Logging is a pretty basic custom implementation as well, and it was an after-thought (log file is constantly opened and written to every time a new line is to be logged, so be sure to disable it if you feel it hitting performance too much). Still, in the current form, the operation was completed in a matter of a couple minutes.
Regarding dependencies, it uses simple Regex matching when possible and also HtmlAgilityPack for parsing the scraped HTML pages into manageable DOMs for easier filtering.
The resulting output DB file is available here.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhE84ZPyaS9CCCmP3mRhk3O412TUPZUup4qEkP2QSzvqSXhJILWRWUSpQ2shgsRU8p-l0H9JtxGlNChUzWh9eGvMGB8UGxGQy9CSaF_bfmXM3rTKIBc_o6rFIyEYd2bFcH1lYITYPJ22zaDeCsEWBYD-W5-Y7jGmJP1Qwvu-sZkHjdxrbbPN33ODpKLRDs/w640-h350/mcqer-scrnsht.png) |
Console output from the program in action |
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDD-ZPPYnrBvix3JLWNVmhvgcjRwcD8M3bq9BenqqLg-MG-pZ9cnIDxRTao5odBm3x7Y_3Be1XUfezSAt0yuLj40A9YgKUvVPwTwqo15qXNo9ipiBUQu7TyZ3cHqSOIDCOQ_M2_spmyOS0vfnDZxAntoiQiJ5PbfVLF2mdq7cQMVKlNjS2BDKVfTHRsqA/w640-h338/db-scrnsht.png) |
Top few entries from the output DB |
UPDATE (31 May, 2024):
I've worked in a few improvements to the program and pushed the code changes to the repository. Now, it can also create Anki-flashcards so that the scraped content is actually useful. Also equally importantly, the program also has a bugfix/QoL enhancement so that the <img> tags are also checked for in the question texts/prompts as well - a possibility that I had ignored before - and the referenced images are downloaded, base64-encoded and replaced in place, ready for use in HTML as-is.
For the past day or two, I was wondering if I should create a separate app (I was thinking maybe a Vue-powered SPA) to actually make use of the DB; but a couple of hours' worth of internet research led me to believe that it would be a lot more efficient if this DB could be made available to Anki instead of reinventing the wheel all over again. Oh, and this apparently really popular app was first brought to my attention by ChatGPT-4o when I asked it "what is the best strategy to memorize around 4500 mcqs for a competitive exam?" Anki was literally the first option in the list it returned where it suggested to use it as a Spaced Repetition System (SRS) for "active learning". I had to download and play around with it for a bit before I could actually understand its workings. I also searched for any and all add-ons the Anki community had for Multiple Choice Questions and a tried one or two of them. But I didn't really like them too much - and I didn't know how I could export the questions from the DB to a form that these add-ons would understand either. So, taking the advice of a wise Reddit user somewhere, I just ditched the idea of using any sort of add-on altogether for MCQs and began exploring the import and export format used by Anki. It turned out that the program can import/export in a few different formats but I chose the simple plaintext format for obvious reasons and studied its structure. I created a new default deck - a term I have gathered means a collection of cards sharing some similarity; so in this case, a deck can represent a category - such as building-materials, or surveying, etc. Then I created two cards manually from inside Anki, each one following the pattern of the question prompt and the multiple options on the front side and the answer on the back side of the card. This is also where I learned that Anki has first-class support for HTML content in its flash-card contents, which was perfect for me since I didn't have to worry about all the tags in my scraped questions and options, not to mention the <img> tags. Anyway, then I exported the cards from Anki's File menu (still not sure if it exports just a single deck or all of them to the same file) to a plaintext file and studied the structure of the exported file. It was really intuitive, and I figured it would be easy enough to automate this process to convert the questions from my scraped DB to this format that Anki understood (I had also successfully tried externally modifying the export file and importing it back to Anki again, without any hiccup). So, that's what I did. I simply added a class library project to the Visual Studio solution and added in the functionality to get read-to-import Anki plaintext files from the SQLite DB produced by MCQer. And voila:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivhiuofIxTyoinvOikJVneHMaizP03nysYwPjnjWSj0UuqjEpJ-pUZ6PytZG2xU3dzd1NqUYOE9Dhq_M-maiJdrsW4tYZApzgpiXAFy87jpxI1AOc63et_Y4KxCmF9UDlBwjxEGyfgKANUIhC4w4BQnsVQ5w9mxknSSpIQy2T7sitIZSJ57ZglN5l286M/w596-h640/output-directory.png) |
The *.txt files are the import-ready Anki plaintext files produced by our program |
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnPsQJFJMxwATTFXJFqZe6gXeeDiqQd9B0w4KR8AWB84bIj2dk_5v96Be1OnjZ18tku-wLnrPZur6GsfzTqEdM-VS5ADyOylmW9gavZCbbmx6LX0yGzL8MT5yLvdjSMMS63RSdkhuPEw23eGkC9PhAq3MQ6frV_aySaFdz9s3BFat1VJre_e-f91XFIx8/w640-h340/Anki-deck-import.png) |
Confirming an import in Anki |
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiudl_sbr-n2EglSd8bVpAIhYO948ZBP7J1Oi9_vVDkLdJ3Ou92a_JrXx9WHfcctBo81qa4AQoVDDGz6RNGhwM7cTiJ0yIhcEDh4iUU5pQ3uYokb5z8TIVPtzXXFfJSX-1GDy9naQvF3UbVq2C0ZWEUoY2nNiFDNez0iF9JTipbif-Awnp4u8JFiG_scHg/w640-h346/Anki-deck-browse-img.png) |
Browsing the imported deck of cards (notice the images) |
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBrcQtJOiua1mxP0N7g56TO-IYRfZPU8egaZ9qoabV5E2etOK4MhUdaDIV7y-xEO0ueNslhRR_oplMXyChr4WkXbWWzWGyXq-fIdaqYS7lzkueAXF50i_fJzA1UX-_nr1C7wQqNg8eCzKk0Ggx_E-SP_IwFAA-bBO0WXRna0S8RbCXlAOsd_mBNwmDNZQ/w640-h346/Anki-deck-browse.png) |
Another file, another deck of cards imported |
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgt-LokuFxDF6npO5rL2l7UB2QFyjNv2g97F3LAcIS1rMAa9vAyel2BJ5YLJuafsYNqGjMfgIGf2RwuzSHoPj70RIMkgQDAYjTNmuJqmydCkdkdJx3sta000oWnjapGD6YrL6OTFeJRIbWjczMqISegEJ00IYX966H1pCN21_NV-1bHJjc2r2fRjPLDNJ0/w640-h564/Anki-deck-after-import.png) |
A flashcard, when in action |