2014年5月17日星期六

How to simulate browser to use Google 's image search

Use Google Image Search for the url is this :
https://www.google.com.hk/search?um=1&newwindow=1&safe=strict&biw=1366&bih=624&hl=zh-CN&tbm=isch&sa = 1 & q = michael + jordan & oq = micheal + & gs_l = img.1.1.0j0i10l4.8923.14151.0.15946.9.9.0.0.0.0.85.329.9.9.0 .... 0 ... 1c.1j4.37 . img .. 3.6.194.B3YpKj-3zlc
What is the meaning behind
gs_l = XXX 's
seems to be removed after search

then use this url in the program ran, could not get the search page , the error is given by :
302 Moved

The document has movedhere.

inquired solution
has no points. . . Find Great God help
------ Solution ------------------------------------- -------
google image search api
https://developers.google.com/image-search/v1/jsondevguide?csw=1
I think this is a good look at what you need
------ For reference only ---------------------- -----------------
Using Java

The following code snippet shows how to make a request to the Google Image Search API using Java. This example uses the JSON library from json.org.

URL url = new URL("https://ajax.googleapis.com/ajax/services/search/images?" +
                  "v=1.0&q=barack%20obama&userip=INSERT-USER-IP");
URLConnection connection = url.openConnection();
connection.addRequestProperty("Referer", /* Enter the URL of your site here */);

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());
// now have some fun with the results...

------ For reference only ----------------------------------- ----
grateful but Google seems to have a limit is 4 × 8张only get search results have a way to get more of it?
------ For reference only -------------------------------------- -
same ask the landlord to solve it? Encounter the same problem , Google provides api limited number of pictures .

没有评论:

发表评论