我有一个使用Rails构建的个人博客。我想在我的网站上添加一个部分,以显示我当前的github贡献。这样做的最佳方法是什么?
编辑:为了澄清,这是我想要的:
对我来说只需要几天的时间。
最佳答案
考虑到GitHub API for Users尚未公开该特定信息(当前捐款流的天数),您可能必须:
正如klamping在his answer中提到的(已赞成),要报废的网址为:
https://github.com/users/<username>/contributions_calendar_data
https://github.com/users/<username>/contributions
(不过,仅适用于公共(public)回购)
SherlockStd在下面有一个updated (May 2017) parsing code:
https://github-stats.com/api/user/streak/current/:username
https://github.com/users/<username>/contributions
_calendar_data
的项目(如Marques Johansson的answer中所列,已投票)然后,您可以阅读该信息并在您的博客中进行报告。
您可以找到刮取该信息的各种示例:
github_team_calendar.py
weekend-commits.js
如:
$.getJSON('https://github.com/users/' + location.pathname.replace(/\//g, '') + '/contributions_calendar_data', weekendWork);
leaderboard.rb
:喜欢:
leaderboard = members.map do |u|
user_stats = get("https://github.com/users/#{u}/contributions_calendar_data")
total = user_stats.map { |s| s[1] }.reduce(&:+)
[u, total]
end