代码之家  ›  专栏  ›  技术社区  ›  Cedric

如何在github中使用github-API搜索代码?

  •  1
  • Cedric  · 技术社区  · 13 年前

    如何通过githubapi搜索某段代码,只知道该段代码中包含的关键字?

    使用搜索词“preg_replace”,键入“code”和语言“PHP”。在任何回购中。

    就像下面的链接一样,但使用了专用的API。

    https://github.com/search?q=preg_replace&repo=&langOverride=&start_value=1&type=Code&language=PHP

    (选中此项,但看不到如何搜索代码。 http://developer.github.com/v3/search/#search-issues https://github.com/search)

    2 回复  |  直到 13 年前
        1
  •  3
  •   shabda    13 年前

    截至2013年7月,可以通过API进行代码搜索:

    https://github.com/blog/1564-code-search-api

        2
  •  0
  •   Cedric    13 年前

    GitHub支持团队的回答(来自永利-感谢您的回答)

    嗨,塞德里克。抱歉,代码搜索目前在API中不可用。 我们正在不断改进API,因此请密切关注文档和 @推特上的GitHubAPI在我们添加新功能时进行更新。

    干杯

    我想我将不得不解析一些HTML(来自 https://github.com/search 结果)。