【问题标题】:Google image search in android安卓中的谷歌图片搜索
【发布时间】:2015-08-27 08:44:31
【问题描述】:

我需要在我的应用中实现 Google 图片搜索,例如 this example

但这里使用的 API 在 Google developer site 中已弃用

我需要像这个示例一样实现相同的功能。是否有任何库可用于 android 中的谷歌图像搜索?做这件事的推荐方法是什么?

【问题讨论】:

    标签: android google-image-search


    【解决方案1】:

    现在,您可以通过 HTTP 查询对 https://serpapi.com/ 执行搜索。

    该服务返回一个漂亮的 JSON,其中包含 google 搜索中的所有图像。 此外,SerpAPI 提供与 Java 的集成。因此,您会发现将此服务集成到您的应用程序中非常容易。

    图片搜索文档。 https://serpapi.com/images-results

    Java 示例。

    Map<String, String> parameter = new HashMap<>();
    parameter.put("q", "Coffee");
    parameter.put("location", "Austin, Texas, United States");
    parameter.put("hl", "en");
    parameter.put("gl", "us");
    parameter.put("google_domain", "google.com");
    parameter.put("api_key", "yourkey");
    
    GoogleSearchResults serp = new GoogleSearchResults(parameter);
    JsonObject results = serp.getJson();
    

    https://github.com/serpapi/google-search-results-java

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多