通过可汗学院API获取文章(Getting articles through the Khan Academy API)

编程入门 行业动态 更新时间:2024-10-28 12:29:25
通过可汗学院API获取文章(Getting articles through the Khan Academy API)

如何通过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

更多推荐

本文发布于:2023-08-04 09:19:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1415117.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:可汗   学院   文章   Khan   Academy

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!