Last active
August 29, 2015 14:06
-
-
Save nsfmc/ab6d0e73e4aef3fc5ba8 to your computer and use it in GitHub Desktop.
getting sizes (amount of content) for each subject in khan academy
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
# 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