如何通过Khan Academy API获取主题文章? 我可以看到它如何与练习和视频一起使用,但文章呢?
例如查询
http://www.khanacademy.org/api/v1/topic/beginners-art-history
返回页面的内容
https://www.khanacademy.org/humanities/art-history-basics/beginners-art-history/
我怎样才能获得“西方文化简史”这篇文章的内容呢?
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?
最满意答案
对文章的正确API调用是:
http://www.khanacademy.org/api/v1/articles/%s
在主题API调用返回的JSON中,在“child_data”数组中为上面的%s使用“id”(文章的“kind”条目的值为“article”。)
(您还可以使用“child_data”数组中的“id”在“children”数组中查找相应的“internal_id”,以获取有关该文章的一些基本信息,例如标题和说明。)
所以对于你的主题电话,
http://www.khanacademy.org/api/v1/topic/beginners-art-history
你得到id“1314267931”,然后打电话
http://www.khanacademy.org/api/v1/articles/1314267931
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
更多推荐
发布评论