In our university (Sharif University of Technology) most students are able to purchase their lunch or dinner with a cheap price from the Universities Dining Institution. However, the meal must be purchased 4 days before the time it is served.
So every time we had to open the browser and reach to dining.sharif.edu, login to our own dining account (Entering username and password), navigate to the reservation section and click on every meal we wanted for a specific day.
This comes with a problem, A lot of us used to forget the reservation due time and ended up dealing with higher priced meals or in some cases starvation :O
There were different solutions to this problem, the most simplest one was that every time someone noticed the reservation time, he or she would message others to remind. Some used to set an alarm. Most of these solutions were useful and were good enough but it still required the user to login and do all the reservation process which was explained above. Most of the time we were getting distracted from reserving the meals and forgetting to complete the reservation process.
Until one day everything changed…
Introducing SweetCookie
SweetCookie is the name of a web crawling bot which means it has the ability to navigate in different websites as a human user and perform the same tasks that an ordinary user does on a website (e.g. Clicking, Logging in), it uses this ability to navigate into dining.sharif.edu. The bot also has a Telegram Bot Interface so the users can control the bot in a user-friendly environment.

How I came up with this idea?
At my first years of my university program I used to order my lunch on the dining.sharif.edu portal. The process was pretty much boring and repetitive, but the amount I used to save by purchasing the cheap meals were very worth it! At that time I was thinking if humans are now shifting towards automating repetitive processes and giving the boring tasks to robots to accomplish, why shouldn’t there be a bot to do this process. After all, the website is already loaded in a robot (In my opinion a laptop or any other PC is a kind of robot). At that time I had a very small amount of knowledge about web crawlers and internet bots.
Other students had some solutions for this, one of them was a Telegram bot which works as a reminder and notified you whenever the reservation time was reached. The bot was named Somagh and it was developed by a Computer engineering student at our university. The bot was the first ever programming solution which was ever given.
Challenges
After a few months, at the end of my second university year I got familiar with Python which was a very easy to learn programming language. I tried to write a Python script to preform the same tasks I do in the dining.sharif.edu portal. Different libraries including Selenium, Requests, BeautifulSoup, etc. were tested. The scripts were not able to get further enough in the dining portal. The reason was that the scripts were unable to locate buttons which were generated using JavaScript in the dining page.
But I had to find a way to click those buttons…
It took a while for me trying all sorts of frameworks and libraries to find something that works. Until I found one, CasperJS. It’s purpose was to find and navigate in webpages which included JavaScript codes inside them. The only concern that I had was that it was a JavaScript framework which required me to learn JavaScript and concepts in Node JS.
Fortunately, it was pretty straight forward for me since the syntax of the JS language was pretty familiar for C/C++ users. I also had to deal with CSS selectors which was used to address different elements in the webpage.
After all this struggle, I finally made it! I made a script in JS which was able to login using the given username & password and click the buttons in order to reserve a meal. At last I had to write a script for it’s user interface, I choose to use Telegrams bots interface because of its convenience for both programmers and users. I used a python library called PyTelegramBotAPI to provide that interface.
Finally the bot was ready at the end of the Summer of 2018. The bot was launched from the beginning of the Fall semester but I was the only user of it since I didn’t announce that there is such a bot to use. I spotted a few bugs and fixed it. After a few weeks of tests I announced the release of the bot in our CE94 telegram group which almost all of my university classmates were part of it. After a day, almost 30 students signed up in the bot. After a few weeks the bot reached to 60 active users. Until the end of the semester I received different improvement suggestions and bug reports from the users and tried to implement and fix them.
The Fall semester finished and the bot passed the 100 users milestone. The bot was way more improved than the first days it was launched. After adding the automated reserve feature I finally made an official announcement of the release of the bot. I asked a couple of CE students which had the tools to advertise my bot to other students in the university to introduce Sweet Cookie. After that the number of users increased to about 300.
Today is the anniversary of the first launch of the bot. I shall say that I’m glade to be one of those persons who made some sort of benefit to the community of Sharif or even other universities!
It’s worth to say that I’m not the first person who started these kinds of free contributions. I was inspired by a student from an older grade of our department, Sadjad Fouladi Who created the term.inator.ir which helps us to schedule our courses with the least amount of mistakes and we won’t need to deal with the ugly interface of our edu.sharif.edu portal (most of the times).
Conclusion
At the end I realized how powerful automation is, if it is correctly implemented. A robot in a real world may accomplish tasks which requires a couple of humans to finish, but a robot in the internet could perform tasks which tens or hundreds of humans or even more need to finish it.
I was asked multiple times about the benefits that I was gaining from providing this free service to others, after all the servers which were running the bot were making some expenses for me! and beside that, why is the project open-source?!?!
Well in answer I have 2 reasons to give: First, I wanted to gain the skills and experience of making an automated bot. Second, is to gain a bit of media power so I can announce a thought or make an influence in my university using this bot, the bot gives me the ability to send messages to all its users. I can also use it as an advertising tool and maybe have an income out of it. I used this feature once, At the election of the Student Scientific Chapter of the Computer department in our university. What I did was that I posted an announcement to all the users of Sweet Cookie to support these nominees and showed there names and pictures. I’m sure it increased there chance in winning the election.
Github page of the Sweet Cookie project: github.com/onajafi/sweetcookie
The bot in Telegram: t.me/Sweet_Cookie_Bot
The Sharif dining portal: dining.sharif.edu
This is inspiring for me …
Great job
Glad to hear that!!!
Fascinating! I absolutely liked your app and used it for more than a year before the pandemic.
Hope you aim for more excellent works!
Hey Qasem!
Not all ideas are easy to develop. But, influencers like you motivate others to overcome the challenges and failures. I notice this while receiving your feedbacks about Sweet Cookie.
Thanks for everything!
Hope you do great things and help more people in the future.