使用 API 在源文件中搜索 Github 个存储库
Search on Github repositories inside source files using API
我正在尝试使用 Github 中的搜索代码,如下所示 link:
他们给出了一个在 Github 中搜索没有 API 的“字符串”的示例,如下所示:
search "amazing" in language:go
有没有办法应用最后一个查询来从他们正在呈现的 API 中获取结果?
帮助页面提到:
The REST API supports the same qualifiers as GitHub.com.
To learn more about the format of the query, see Constructing a search query.
See "Searching code" for a detailed list of qualifiers.
你的情况:
curl -G https://api.github.com/search/code \
--data-urlencode 'q=amazing language:go org:github' \
--data-urlencode 'sort=indexed' \
--data-urlencode 'order=desc' \
-H 'Accept: application/vnd.github.preview'
但是:since 2013, for an API search (not Web search), a user, organization, or repository qualifier is now required, as confirmed here.
- there currently isn't support for code searches using the GraphQL v4 API (look for GraphQL API v4 ChangeLog)
- “Considerations for code search”,按文件名搜索不受 user/org/repository 要求。
我正在尝试使用 Github 中的搜索代码,如下所示 link:
他们给出了一个在 Github 中搜索没有 API 的“字符串”的示例,如下所示:
search "amazing" in language:go
有没有办法应用最后一个查询来从他们正在呈现的 API 中获取结果?
帮助页面提到:
The REST API supports the same qualifiers as GitHub.com.
To learn more about the format of the query, see Constructing a search query.
See "Searching code" for a detailed list of qualifiers.
你的情况:
curl -G https://api.github.com/search/code \
--data-urlencode 'q=amazing language:go org:github' \
--data-urlencode 'sort=indexed' \
--data-urlencode 'order=desc' \
-H 'Accept: application/vnd.github.preview'
但是:since 2013, for an API search (not Web search), a user, organization, or repository qualifier is now required, as confirmed here.
- there currently isn't support for code searches using the GraphQL v4 API (look for GraphQL API v4 ChangeLog)
- “Considerations for code search”,按文件名搜索不受 user/org/repository 要求。