Automating University Schedule #1
Guido Pereira
Posted on October 21, 2019
Index
- ๐ค Why?
- ๐คจ How?
- How did I do it?
- Code Showcase
- Final Results
- ๐ค Conclusion
๐ค Why?
Around 1 month ago I started university, and one of the things I found myself doing all the time was looking at my schedule looking for what classes I had and in what classroom it was. I found that really annoying, mostly because the only way to check it was in a online page. ๐ฃ
One of the things I like to do is to automate things I do more than once. And this type of project is why I got into programming in the first place.
So, I have to use my programming skills to solve / automate this scenario which will save my screen time.
๐คจ How?
How I did it?
First, I learned how to use the Google Calendar in Node.js. Then, I realized that I had to do everything because there isn't any tool already created to do what I want. So I decided to roll up my sleeves and get down to business. ๐ช
In this first version it was a lot more manual than I had hoped for, but it gave me a foundation that I could build upon and improve in future versions. ๐ค
Well, by manual I mean I had to do this steps:
- Open google chrome developer console
- Navigate into the schedule page
- Login with my credentials
- Check the network (in the console) for the response that contained the schedule .json
- Save that file to my desktop
- Run my application
And after all that is done I have my schedule in my calendar, which then synchronizes in all my devices, including my smartphone.
Code Showcase
Here are the overall steps and gist.
-
Then I had to authenticate into google calendar, for that I used this npm package for node.js:
googleapis / google-api-nodejs-client
Google's officially supported Node.js client library for accessing Google APIs. Support for authorization and authentication with OAuth 2.0, API Keys and JWT (Service Tokens) is included.
It wasn't that difficult as long as you follow the quick guide that google provides:
- Next, I looped through all the Classes and Created a Event for each to add to Google Calendar
Final Results
In this first version I had the functionality working, even though it's not really automated it does what I need to.
And this is what I got:
๐ค Conclusion
This is what technology is all about. Identify the problem and come up with a solution, even if the solution takes some versions to be good.
There are so many possibilities with the combination of the tools like GoogleApi and Node.js. And with those we can increase our productivity.
!!! Be sure to Comment ๐ ... You guys all Rock !!!
P.S: This is my first post. Feel free to point out any mistakes so I can improve
P.S2: When I have the time I will post the second part where I really automate it
Posted on October 21, 2019
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.