Files
canvas-student-data-export/README.md
2026-03-08 00:30:31 -08:00

3.4 KiB

Canvas Student Data Export

A set of tools to back up nearly all of a student's data from the Instructure Canvas LMS. Useful when graduating or leaving a university and wanting to preserve your course data.

For full setup and usage instructions, see GUIDE.md.

Tools

export.py — Canvas Data Exporter

Exports course data from all active and completed Canvas courses as JSON files, with optional HTML snapshots.

Exports:

  • Course Assignments (including submissions and attachments)
  • Course Announcements
  • Course Discussions
  • Course Pages
  • Course Files
  • Course Modules
  • (Optional) HTML snapshots of:
    • Course Home Page
    • Grades Page
    • Assignments
    • Announcements
    • Discussions
    • Modules

Data is organized into folders by academic term and course:

output/
  Fall 2023/
    CS 101/
      announcements/
      assignments/
      course files/
      discussions/
      modules/
      grades.html         # (--singlefile only)
      homepage.html       # (--singlefile only)
      CS 101.json
  all_output.json

Downloads all Kaltura lecture videos from your Canvas courses' Media Galleries using yt-dlp. Tracks completed courses via a cache file so it can safely resume if interrupted. Videos are saved to output/{Term}/{CourseCode}/Lectures/Kaltura/.

Getting Started

Dependencies

  • Python 3.8 or newer
  • Node.js 16 or newer (only needed for --singlefile HTML snapshots)
  • ffmpeg (only needed for kaltura_downloader.py)

Install Python dependencies:

pip install -r requirements.txt

(Optional) Install SingleFile for HTML snapshots:

npm install

Configuration

Create a credentials.yaml file in the project root:

# The URL of your Canvas instance (e.g., https://your-school.instructure.com)
API_URL: https://example.instructure.com
# Your Canvas API token
API_KEY: <Your Canvas API token>
# Your Canvas User ID
USER_ID: 123456
# Path to your browser cookies file (Netscape format).
# Required for --singlefile and kaltura_downloader.py.
# COOKIES_PATH: ./cookies.txt
# Required for kaltura_downloader.py only.
# KAF_COOKIE: <kms_ctamuls cookie value from canvaskaf.ucsd.edu>
# (Optional) Path to Chrome/Chromium if SingleFile cannot find it.
# CHROME_PATH: /usr/bin/chromium
# (Optional) SingleFile capture timeout in seconds. Default: 60
# SINGLEFILE_TIMEOUT: 180
# (Optional) Course IDs to skip.
# COURSES_TO_SKIP:
#   - 12345
#   - 67890

Finding your credentials:

  • API_KEY: Canvas → Account → Settings → Approved Integrations → "+ New Access Token"
  • USER_ID: Visit https://<your-canvas-url>/api/v1/users/self while logged in and find the id field
  • COOKIES_PATH: Export cookies from your browser in Netscape format using an extension like "Get cookies.txt Clean"
  • KAF_COOKIE: The kms_ctamuls cookie from canvaskaf.ucsd.edu — log into Canvas, navigate to a Media Gallery, then inspect cookies on canvaskaf.ucsd.edu

Running

# Export all course data as JSON
python export.py

# Export with HTML snapshots
python export.py --singlefile

# Download Kaltura lecture videos
python kaltura_downloader.py

See GUIDE.md for all CLI options and detailed setup steps.

Contribute

I would love to see this script's functionality expanded and improved! I welcome all pull requests 🙂 Thank you!