1

我是一个试图分析和挖掘 GitHub 存储库的团队的首席学生研究员。我们正在尝试为托管在 Github 上且满足以下条件的每个项目获取(repo_owner 和 repo_name):

query MyQuery {
  search(query: "language:Python", type: REPOSITORY, 
    first: 100
  ) {
    pageInfo {
      endCursor
      hasNextPage
    }
    edges {
      node {
        ... on Repository {
          nameWithOwner
          issues {
            totalCount
          }
          defaultBranchRef {
            target {
              ... on Commit {
                history(first: 0) {
                  totalCount
                }
              }
            }
          }
        }
      }
    }
  }
}

我们能够遍历游标 10 次。但是当我们到达光标 "Y3Vyc29yOjEwMDA="

query MyQuery {
  search(query: "language:Python", type: REPOSITORY, 
    first: 100, after:"Y3Vyc29yOjEwMDA="
  ) {
    pageInfo {
      endCursor
      hasNextPage
    }
    edges {
      node {
        ... on Repository {
          nameWithOwner
          issues {
            totalCount
          }
          defaultBranchRef {
            target {
              ... on Commit {
                history(first: 0) {
                  totalCount
                }
              }
            }
          }
        }
      }
    }
  }
}

我们得到以下响应:

{
  "data": {
    "search": {
      "pageInfo": {
        "endCursor": null,
        "hasNextPage": false
      },
      "edges": []
    }
  }
}

我从 Github 上的快速高级搜索中得知,该网站上目前托管了约 4,000,000 个 Python 语言公共存储库。在遇到这个空游标之前,我们只能得到 1000。

请让我们知道是否有解决此问题的方法。我们希望继续使用 v4 API,因为它具有极简的数据输出(即,它只为我们提供我们想要的:repo_owner 和 repo 名称以及问题计数和提交计数)。

谢谢您的帮助!

4

0 回答 0