小编use*_*845的帖子

Google凭据:此开发者帐户不拥有该应用程序

我正在使用Google客户端库并尝试GET向Google Play API发出请求.

        GoogleCredential credential= new GoogleCredential.Builder().setTransport(netHttpTransport)
                .setJsonFactory(jacksonFactory)
                .setServiceAccountId(CLIENT_ID)
                .setServiceAccountScopes(SCOPE)
                .setServiceAccountPrivateKeyFromP12File(file)
                .build();
                credential.refreshToken();     
        HttpRequestFactory requestFactory =netHttpTransport.createRequestFactory(credential);
        GenericUrl url = new GenericUrl(URI);
        HttpRequest request = requestFactory.buildGetRequest(url);
        HttpResponse response = request.execute();
Run Code Online (Sandbox Code Playgroud)

我明白了

 {
  "code" : 401,
  "errors" : [ {
    "domain" : "androidpublisher",
    "message" : "This developer account does not own the application.",
    "reason" : "developerDoesNotOwnApplication"
  } ],
  "message" : "This developer account does not own the application."
}
Run Code Online (Sandbox Code Playgroud)

我的应用程序未发布,会导致问题吗?

google-api google-api-java-client

11
推荐指数
2
解决办法
3115
查看次数

如何使用谷歌API从谷歌图像保存图像?

我正在尝试在Google图片中搜索一些不同的图片,并使用java Google API保存每个查询的第一个结果.

我设法在Google中搜索并获取包含搜索结果的json对象.该对象包含包含图像的网站,而不包含图像地址

码:

URL url = new URL("https://ajax.googleapis.com/ajax/services/search/images?" +
                    "v=1.0&q="+properties.getProperty(Integer.toString(i))+"&userip=IP");
            URLConnection connection = url.openConnection();
            connection.addRequestProperty("Referer", "images.google.com");

        String line;
        StringBuilder builder = new StringBuilder();
        BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
        while((line = reader.readLine()) != null) {
        builder.append(line);
        }

        JSONObject json = new JSONObject(builder.toString())
Run Code Online (Sandbox Code Playgroud)

如果我有图像链接,我也知道如何保存图像.

我的问题是如何获得第一个(或第二个或其他)图像正确的地址而不是网址(例如www.yadayadayada.com/image.png)

10倍

java image google-image-search

2
推荐指数
1
解决办法
1万
查看次数