Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting articles through the Khan Academy API

Tags:

khan-academy

How can I get the articles of a topic through the Khan Academy API? I can see how it works with exercises and videos, but what about articles?

For example the query

http://www.khanacademy.org/api/v1/topic/beginners-art-history

returns the contents of the page

https://www.khanacademy.org/humanities/art-history-basics/beginners-art-history/

How can I get the content of the article "A brief history of Western culture" inside it?

like image 898
sofia Avatar asked Oct 17 '22 21:10

sofia


1 Answers

The correct API call for an article is:

http://www.khanacademy.org/api/v1/articles/%s

In the JSON returned by your topic API call, use "id" in the "child_data" array for the %s above (the articles have the "kind" entries with value "article".)

(You can also use "id" in the "child_data" array to look for the corresponding "internal_id" in the "children" array to get some basic information about the article, e.g. title and description.)

So for your topic call,

http://www.khanacademy.org/api/v1/topic/beginners-art-history

you get the id "1314267931" and then call

http://www.khanacademy.org/api/v1/articles/1314267931

like image 166
Jannie Gerber Avatar answered Oct 21 '22 07:10

Jannie Gerber