Format for a url that goes to Google image search?
Asked Answered
A

6

92

I have a web page which has links at the bottom like this:

- <a href='http://www.google.com/q?rome+photos'>photos of rome</a>
- <a href='http://www.google.com/q?paris+photos'>photos of paris</a>
- <a href='http://www.google.com/q?london+photos'>photos of london</a>

The idea is that if somebody clicks we go to Google search image page and we search for those images of those cities.

The questions are:

  1. what's the right URL for starting an image search in Google
  2. is there a place in Google documentation where I can find this ? (I searched and could not find it)
  3. does Google restrict this type of usage for some reasons?
Anthozoan answered 3/2, 2014 at 14:45 Comment(4)
if instead of redirecting users off your page and to the image search page you can use their api to include searches into your page developers.google.com/custom-searchEstablishmentarian
@PatrickEvans my understanding is that custom-search will not allow me to search over the internetAnthozoan
you can custom search API to search all of google.. use cx=003297764410947261360:hlyqxsuk4js which I got from here: support.google.com/programmable-search/answer/12499034?hl=en for the second page just add &num=10&start=11Passport
This question is about exactly what I wanted to know, 9 years later. But it seems that none of the solutions below, which I have used in the past, no longer work in 2023. For example, these two URLs appear to take me to the same “regular”/“non-image” search results: google.com/images?q=Chicago and google.com/search?q=ChicagoClass
G
134
  1. url: https://www.google.com/search?tbm=isch&q=findSomeImage,
  2. Nothing official that I'm aware of, but this blog has some documentation.
  3. Nope, no limit you should worry about if you're manually clicking the urls. (I'm sure google has some kind of flood protection against bots, though)

So, the only change you have to make, is to add the tbm=isch option to your urls.

Goines answered 3/2, 2014 at 14:51 Comment(2)
tbm=isch ("isch" = "image search")Smattering
As of June 2024, Google seems to rewrite &tbm=isch to &udm=2 instead.Suter
S
26
http://www.google.com/search?q=<SEARCH TERM>&tbm=isch

The tbm=isch is the internal google search parameter that determines what kind of search to perform. There doesn't seem to be any official documentation on it, but this page has a decent write up:

Google Search Request Params

It looks like if you don't include the "/search" part of the string, it fills the google searchbox, but doesn't actually execute the search.

Sonnnie answered 3/2, 2014 at 14:50 Comment(3)
I agree - this doesn't work in Safari but it does in Chrome.Seraphim
Pasting the link into chrome works. Clicking it works in both chrome and safari. But pasting it into safari does not work.Seraphim
If your wanting to do something on an industrial scale, you might want to consider creating a google cloud app and then using their API to get JSON search results. A URL like this works, the cx bit says "use google" .. googleapis.com/customsearch/…Passport
S
21

Use the "images" keyword instead of "search" (this should also work for "videos", "maps", etc.)

http://www.google.com/images?q=your+search+terms

https://productforums.google.com/d/msg/websearch/No-YWMdgFp8/l_SNghlwCV0J

Update

Following Chris F Carroll's comment below, I had a look with Fiddler. The /images request results in a 301 (moved permanently) response with the redirect URL in the format www.google.com/search?q=search+terms&tbm=isch as described by other answers here.

Contrary to what I said above (taken from the linked article), the /video request doesn't work. /maps does work, and doesn't result in a redirect.

Silvie answered 13/5, 2015 at 14:54 Comment(3)
In what way? It works for me in Chrome. I pasted "google.com/images?q=pluto+flyby" into the address bar and it showed me relevant image results. (Hmm, I typed that in with the "http" prefix but it's not showing up in the comment.)Silvie
Interesting. For me, it's hit and miss. Example: If I click your link that works, but I think my browser (safari) is making it work. If I try to copy/paste it without the trailing quote mark it gives me text, not image, resultsFulvia
@chris - it's not Safari making it work, it's a redirect. See updated answer. (Sorry about the trailing quote included in the link - I can't seem to edit the comment to correct it.)Silvie
A
10

Please use below URL for google image search

http://images.google.com/images?um=1&hl=en&safe=active&nfpr=1&q=your_search_query

Replace your_search_query with your own search term. Please note this url will behave differently according to the user agent. Google can identify whether this request comes from a browser or a bot

Also note you can add another query string to navigate through this image search

http://images.google.com/images?um=1&hl=en&safe=active&nfpr=1&q=your_search_query&start=30

This will make the search start from 3rd page. I hope this helps somebody.

Aintab answered 3/5, 2019 at 18:40 Comment(3)
This has added benefit of loading the non javascript image search page.Hillegass
Many thanks for this! Let me just add that only 2 parameters seem necessary for an image search. You can try http://images.google.com/images?q=your_search_query&tbm=isch, it works fine for me.Wingard
This answer adds a load of unnecessary parameters.Goines
S
5

This is the link that works for me: https://www.google.com/search?q=rome+photos&source=lnms&tbm=isch

Sodium answered 3/2, 2014 at 14:51 Comment(2)
&source= is not needed.Goines
Even if you're providing a link with a solution, it's good to at least explain a little what's that about, what's based on, etc...Sunfish
B
2
http://www.google.com/search?q=<SEARCH TERM>&udm=2

An example with the query "malaco vingummi":

https://www.google.com/search?q=malaco+vingummi&udm=2

Bagpipes answered 25/3, 2024 at 14:19 Comment(2)
This redirects to the tbm=isch version.Goines
@Goines For me, it's the reverse. tbm=isch redirects to udm=2.Bagpipes

© 2022 - 2025 — McMap. All rights reserved.