i'm trying to search in Google-images some different and save the first result for every query with java Google API.
I managed to search in Google and get the json object which contains the search results. the object contains the web sites which contains the images,and not the image address
code:
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())
I'm also know how to save image if i had the image link.
my problem is how to get the first (or second or whatever) image right address and not the web address (example www.yadayadayada.com/image.png)
10x