有没有办法通过github api获取网站链接?目前我在使用以下内容时没有看到它:
curl
-H "Accept: application/vnd.github.v3+json"
https://api.github.com/orgs/ORG/repos
我可以获取主题和描述文本,但不能获取网站 (winterbe.com/projects...)。
最佳答案
您需要使用GraphQL API ,并且您正在查找给定存储库下的 homepageUrl
字段。例如,下面的查询将给出给定用户的所有公共(public)存储库,并且对于每个存储库,它将给出其名称、描述和主页:
query MyQuery {
repositoryOwner(login: "username") {
repositories(orderBy: {field: CREATED_AT, direction: DESC}, first: 100, privacy: PUBLIC) {
nodes {
name
description
homepageUrl
}
}
}
}
与 REST API 不同,GraphQL API 需要身份验证。您可以修改查询 here .
关于github - 如何从github API获取网站链接?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67163807/