Skip to content

Instantly share code, notes, and snippets.

@nsfmc
Last active August 29, 2015 14: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 nsfmc/ab6d0e73e4aef3fc5ba8 to your computer and use it in GitHub Desktop.
Save nsfmc/ab6d0e73e4aef3fc5ba8 to your computer and use it in GitHub Desktop.
getting sizes (amount of content) for each subject in khan academy
# getting relative size of each subject in math using
# http://www.khanacademy.org/api/v1/topictree and helper
# methods from https://gist.github.com/nsfmc/2a877c61f0f7da984ead
# to plug into something like https://gist.github.com/nsfmc/2d496c1bb9e096402f8e
output = []
for s in subjects_for_domain('math'):
count = 0
for t in get_topics(domain='math', subject=s['slug']):
for tut in t['children']:
count += len(tut['children']) if tut.get('children') else 0
output.append('name': s['title'], 'size': count})
print json.dumps(output)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment