Skip to content

Instantly share code, notes, and snippets.

@RyanNutt
Last active March 2, 2020 19:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RyanNutt/45eed8f2e6c55274988d77b11eeffa4c to your computer and use it in GitHub Desktop.
Save RyanNutt/45eed8f2e6c55274988d77b11eeffa4c to your computer and use it in GitHub Desktop.
Script to download media submissions from Canvas assignment
import json
import urllib.request
import sys
with open('submissions.json', 'r') as read_file:
data = json.load(read_file)
for sub in data:
filename = sub['user']['name'] + '.mpg4'
print(filename)
try:
url = sub['media_comment']['url']
urllib.request.urlretrieve(url, filename)
except:
print('Unable to save ' + filename)
sys.exit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment