Last active
March 2, 2020 19:06
-
-
Save RyanNutt/45eed8f2e6c55274988d77b11eeffa4c to your computer and use it in GitHub Desktop.
Script to download media submissions from Canvas assignment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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