Joren 333e784ce9 fix: use module_item_redirect OAuth flow for ExternalUrl Panopto items
The Canvas app authenticates ExternalUrl items via:
  GET session_token?return_to=<module_item_redirect>?display=borderless
  → GET session_url → OAuth2 confirm
  → POST /login/oauth2/accept
  → Panopto Login.aspx?code= → CookieCheck.aspx (sets Panopto cookies)

Our previous code used sessionless_launch (the course-level Panopto tool)
for direct Panopto links, which gave wrong/incomplete Panopto cookies.

Added DownloadExternalPanoptoURL() that replicates the exact app flow.
Falls back to DownloadVideo if no Panopto cookies are obtained.
Both List.aspx (folder playlists) and Viewer.aspx (single videos) are
handled with the correct yt-dlp flags and output templates.
2026-05-16 22:33:22 +02:00
2026-05-16 17:33:40 +02:00
2026-02-13 18:49:29 +01:00
2026-02-13 18:49:29 +01:00
2026-02-13 18:49:29 +01:00
2026-03-11 20:12:08 +01:00

Canvas Archiver

A command-line tool to archive Canvas LMS course content, including files, modules, and Panopto video recordings.

Prerequisites

  • Go 1.21 or higher
  • yt-dlp installed and in PATH

Installation

git clone git.directme.in/Joren/CanvasArchiver
cd CanvasArchiver
go build -o canvasarchiver ./cmd/canvasarchiver

Usage

  1. Run the archiver:

    ./canvasarchiver
    

    Or for files-only mode:

    ./canvasarchiver -fo
    
  2. On first run, you'll be prompted to authenticate:

    • Visit the provided OAuth URL
    • Authorize the application
    • Copy the authorization code back to the terminal
  3. Enter your Course ID when prompted (or use -me to download all enrolled courses)

  4. The tool will download:

    • Regular course files (to Course Files/)
    • Module content (to Modules/)
    • Panopto recordings (to Recordings/)

Flags

Flag Description
-fo Files only mode - download all files to a single directory without module structure
-me Download all enrolled courses
-n Prefix modules with order numbers [1], [2], etc.

Configuration

The following constants can be modified in internal/config/config.go:

  • BaseURL: Canvas instance URL
  • ClientID: OAuth client ID
  • ClientSecret: OAuth client secret
  • PanoptoID: Panopto external tool ID

Authentication

Credentials are stored in credentials.json after the first successful login. The refresh token is automatically used for subsequent runs.

Notes

  • Files are organized to match Canvas structure
  • SubHeaders in modules create nested folder structures
  • Videos are downloaded with their original titles
  • Existing files are skipped to avoid re-downloading

License

This project is for educational purposes. Ensure you have permission to download course content.

Description
No description provided
Readme 105 KiB
Languages
Go 97.8%
Makefile 2.2%