我对一个开源项目很感兴趣,但它的文档并未涵盖其中的大部分内容。
该项目的分叉次数超过500次。其中一个分支有一个有趣的wiki,其中包含有关该项目的丰富信息。
我正在考虑列出该项目分叉的所有wiki的链接。
我尝试手动浏览一些叉子,但这需要时间,而且一些叉子首先没有维基!
那么有没有办法在Github上列出特定项目的分支wiki链接?
答案 0 :(得分:1)
您可以使用GitHub API:
https://developer.github.com/v3/repos/forks/#list-forks
GET /repos/:owner/:repo/forks
您将获得一个看起来像这样的叉子列表(示例来自链接,为简洁而缩短):
[
{
"id": 1296269,
"owner": {
"login": "octocat",
"id": 1,
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
(...)
},
"name": "Hello-World",
"full_name": "octocat/Hello-World",
"description": "This your first repo!",
"private": false,
"fork": true,
"url": "https://api.github.com/repos/octocat/Hello-World",
"html_url": "https://github.com/octocat/Hello-World",
"archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
"assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
"blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
"branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
"clone_url": "https://github.com/octocat/Hello-World.git",
(...)
"tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
"teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
"trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
"homepage": "https://github.com",
"language": null,
"forks_count": 9,
"stargazers_count": 80,
"watchers_count": 80,
"size": 108,
"default_branch": "master",
"open_issues_count": 0,
"topics": [
"octocat",
"atom",
"electron",
"API"
],
"has_issues": true,
"has_wiki": true,
"has_pages": false,
"has_downloads": true,
"pushed_at": "2011-01-26T19:06:43Z",
"created_at": "2011-01-26T19:01:12Z",
"updated_at": "2011-01-26T19:14:43Z",
"permissions": {
"admin": false,
"push": false,
"pull": true
},
"allow_rebase_merge": true,
"allow_squash_merge": true,
"allow_merge_commit": true,
"subscribers_count": 42,
"network_count": 0
}
]
您可以通过查看has_wiki
属性来过滤实际拥有维基的回购:
"has_wiki": true
不幸的是,有很多带有属性的网址,但维基网址不是其中之一。
所以你需要自己构建它 幸运的是,GitHub的wiki网址很简单:
https://github.com/:owner/:repo/wiki
因此,通过上面的例子,它只是:
https://github.com/octocat/Hello-World - > https://github.com/octocat/Hello-World/wiki