Skip to content

CLI to download & view canvas videos, files and other info

License

Notifications You must be signed in to change notification settings

aidanaden/canvas-sync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

canvas-sync

CLI to download (course files, videos, etc) & view (deadlines, events, announcements) from Canvas

Contents

Install

Brew (mac/linux/wsl)

Brew is a package manager for macOS (or linux) that helps you install packages easily - more info here

To install Brew:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

To install canvas-sync with Brew:

brew install aidanaden/tools/canvas-sync

Scoop (windows)

Scoop is a package manager for windows that helps you install programs from the command line (Brew but for windows) - more info here

To install Scoop, launch powershell and run:

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
irm get.scoop.sh | iex

To install canvas-sync with Scoop:

scoop bucket add scoop-bucket https://github.com/aidanaden/scoop-bucket.git
scoop install canvas-sync

You can also download directly from the releases page

Autocomplete (mac/linux/wsl)

Warning: skip if you don't know what zsh is

Run the following code block to add autocompletion for canvas-sync to your shell.

zsh

Code
echo "\n\nif type brew &>/dev/null
then
  FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}"

  autoload -Uz compinit
  compinit
fi" >> ~/.zshrc && source ~/.zshrc

bash

Code
echo "if type brew &>/dev/null
then
  HOMEBREW_PREFIX="$(brew --prefix)"
  if [[ -r "${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh" ]]
  then
    source "${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh"
  else
    for COMPLETION in "${HOMEBREW_PREFIX}/etc/bash_completion.d/"*
    do
      [[ -r "${COMPLETION}" ]] && source "${COMPLETION}"
    done
  fi
fi" >> ~/.bash_profile && source ~/.bash_profile

fish (not necessary if you installed fish via homebrew)

Code
echo "if test -d (brew --prefix)"/share/fish/completions"
    set -gx fish_complete_path $fish_complete_path (brew --prefix)/share/fish/completions
end

if test -d (brew --prefix)"/share/fish/vendor_completions.d"
    set -gx fish_complete_path $fish_complete_path (brew --prefix)/share/fish/vendor_completions.d
end" >> ~/.config/fish/config.fish && source ~/.config/fish/config.fish

Updating

Brew

If installed using brew, simply run:

canvas-sync upgrade

Scoop

If installed using scoop, simply run:

scoop update; scoop update canvas-sync

You can also download the latest version directly from the releases page

Set-up

To set up canvas-sync, run the init command:

canvas-sync init

init completed

  1. First, enter the directory to store all downloaded canvas data (files, videos, etc) e.g. $HOME/Desktop/canvas, if left blank all downloaded data will be stored in $HOME/canvas-sync/data

  2. Next, enter your school's canvas website url, if left blank it'll be set to https://canvas.nus.edu.sg (i'm from nus after all)

  3. You'll be asked for your username and password to log in to canvas (required for video downloads)

  4. After logging in, your config will be successfully created and all other commands will work, check them out here

Config

All configuration is done in the $HOME/canvas-sync/config.yaml file.

4 values can be configured:

  • data_dir: directory to store downloaded canvas data, defaults to $HOME/canvas-sync/data
  • canvas_url: URL of your target canvas site, defaults to https://canvas.nus.edu.sg
  • canvas_username: your canvas site username
  • canvas_password: your canvas site password
  • access_token (DO NOT EDIT): token generated by the init command to download from canvas directly, if not filled you'll need to run canvas-sync init

To create a config file, run canvas-sync init

Commands

Init

Creates a new config file in the default directory $HOME/canvas-sync

init

Pull

Downloads data (files, videos, etc) from canvas, overwrites all existing data

Pull Files

pull files demo

View documentation via pull files -h

Pull Videos

pull videos demo

View documentation via pull videos -h

Update

Updates downloaded data (files, videos, etc) from canvas

Update Files

update files demo

View documentation via update files -h

Update Videos

update videos demo

View documentation via update videos -h

View

Display data from canvas (deadlines, events, announcements, etc)

View Deadlines (assignments)

Display past/future assignment deadlines

view deadlines demo

View Events (Announcements/lectures/tutorials)

Display past/future lectures/announcements

view events demo

View People (from a given course)

Display people from a given course code

view people demo

FAQ

What is this $HOME thing? It's the main directory of the current user. For mac/linux it'll be `/Users/`, for windows it'll be `C:\Users\`
It doesn't work for my university This tool was built by an NUS student (me), hence i'm not able to test it with canvas sites from any other university. Please create an issue at https://github.com/aidanaden/canvas-sync/issues regarding any problems you face with your school's canvas website. Thank you! :)
Is my username/password stored anywhere? No, we do not store any credentials. When running the `init` command, the tool logs in to your canvas website and creates an access token that allows the tool to access your canvas data on your behalf.

If there are any other questions, please create an issue here, if it's a common enough issue i'll add it to the FAQ section here :)

LICENSE

MIT

About

CLI to download & view canvas videos, files and other info

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages