Skip to content

A web scraper application for syncing your Lectio schedule with Google Calendar

License

Notifications You must be signed in to change notification settings

mattismoel/lectigo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What is this?

This project is a web scraper for the Danish gymnasium site Lectio by MaCom A/S. With this, you are able to extract the schedule from the main site and have it sync with your Google Calendar.

How to use

Clone the repository to a desired location

$ git clone "https://github.com/mattismoel/go-lectio-scraper.git

Golang Project

Tidy the project

$ go mod tidy

To build the project binary for MacOS, Windows and Linux, run the following command:

$ make build

This exports the binaries to the bin directory.

Usage

The project can be run either by the executable (with make run or direct call on the executable in the bin directory) or the go run command. Generally, the executable will be faster.

Examples

Syncing Lectio schedule with Google Calendar with modules for the next three weeks:

$ lego sync -u username1234 -p password1234 -s 133 -c somecalendarid1234@group.calendar.google.com -w 3

Clearing all Lectio modules from Google Calendar

Note: This DOES NOT delete normal events from your calendar. Only Lectio modules are targeted.

$ lego clear -c somecalendarid1234@group.calendar.google.com

Google OAuth authentication

This project makes use of the Google Calendar API, and therefore needs you to log in with your Google Account. When the application is run for the first time, a link will appear for you to log in. Click this link and enter confirm that Lectigo can modify your Google Calendar. When confirmed the syncing process should start automagically.

Google Calendar ID

The list of calendars that you own can be found at Google Calendar API's documentation CalendarList:list(). In the sidebar, you should see an Execute button. The resulting JSON is a list of your Google calendars. Find the desired calendar, copy the value of "id" and paste it into the googleSecrets.json file. Everything should be ready to go.