This example NodeJS application scrapes a website for your team's upcoming sporting event using Cheerio and syncs the event times with your Google Calendar.
The program runs on a regular basis using cron scheduling inside a Docker container, which ensures that your calendar stays up-to-date with the latest information about the upcoming events.
To use this script, you will need:
- Docker installed on your machine
- Google Calendar API credentials: Service account
- Use this template repository and clone it to your local machine.
- Run
npm install
oryarn
- Modify the
webScraper.js
file to fetch the information from your team's website. Update the URL and HTML parsing. - Follow the instructions here to set up your Google Calendar API credentials and download the
credentials.json
file. - Rename the
credentials.json
file toservice_account_key.json
and place it in the root directory of the project. - Modify the
calendar.js
file to format the event with your custom scraped data. - To run the local repo you can use
npm start
- The Docker image will be built whenever you create a release for your repo
- It's currently setup to build for servers running
arm64
but you can customise that in theDockerfile
and Github Action files - Run the Docker container using
docker run -d --name volleysync-container ghcr.io/your-github-user/your-forked-repo
- Move your service account key into the Container using docker cp:
docker cp service_account_key.json your-docker-container-name:/app/service_account_key.json
- The script will run every hour and create events on your Google Calendar for any upcoming sporting events.
To manage the calendars settings and visibility options etc you can give your own personal google account access to it via an acl. This will allow you to manage the calendar through the standard Google calendar website