相关疑难解决方法(0)

如何在Google Programmatically Java API中搜索

有没有人知道是否以及如何以编程方式搜索Google - 特别是如果有Java API?

java google-search-api

104
推荐指数
3
解决办法
11万
查看次数

如何使用谷歌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万
查看次数