DEV Community

Cover image for Automating University Schedule #1
Guido Pereira
Guido Pereira

Posted on • Updated on

Automating University Schedule #1

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. ๐Ÿ˜ฃ

schedule

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.

coding

๐Ÿคจ 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.

  1. First I save the .json in the app folder
    jsonResponse

  2. Then I had to authenticate into google calendar, for that I used this npm package for node.js:

    GitHub logo 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:

  1. 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:
Horario Helper

Google Calendar

๐Ÿค— 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

Top comments (0)