我如何获得 GitHub 存储库的描述?

How can i get the description of a GitHub repo?

每个 GitHub 存储库 都有一个 描述 字段 和一个可选的 网站字段。如何使用 AJAX 访问这些字段 (任何 GitHub 存储库的)

Select2 插件的 page 上。他们正在利用 github 的 api 来搜索存储库并以 json 的形式检索结果。 完整 github api 可用 here.

Github 提供 API 以获取有关存储库的详细信息:

https://api.github.com/repos/<organization>/<project>

例如。 https://api.github.com/repos/ruby/ruby

您可以使用简单的 jQuery 来获取您需要的信息:

$.ajax('https://api.github.com/repos/ruby/ruby').done(function(json) { 
   // You can access the description as json.description
   console.log(json.description);       
});