22

I've got a collection of images that I'm missing information for. I'd like to be able to do a Google reverse image search to find names, keywords, links to similar images, etc. I'm aware that scraping the search results page is against the TOS, and have gotten suggestions that using the Custom Search API is the right way to go about it, but I haven't been able to find anything in the documentation detailing reverse image search. Is anyone able to point me in the right direction if this is possible with the API, or verify if it is, in fact, supported?

Much appreciated!

carbide20
  • 1,717
  • 6
  • 29
  • 52

2 Answers2

3

As for current API I have not found any mention of reverse image search functionality. not even anything except string based queries. You can look for yourself in the detail API references for custom search.

https://developers.google.com/custom-search/docs/xml_results

https://developers.google.com/custom-search/json-api/v1/reference/cse/list

So Google-custom-search doesn't provide that facility.

After looking at other APIs provided, none of them also provide this functionality. Try looking at all the different kinds of APIs supported by the Google here:

https://developers.google.com/apis-explorer/#p/

Thus the conclusion, no reverse image search thru API form Google. (this might change, I cant say anything, look at the links provided above)

There are paid apis available from some vendors.

TinEye API https://services.tineye.com/TinEyeAPI

Incandescent API http://incandescent.xyz/pricing/

Otherwise you have to ask Google to pardon you for the little TOS violation for your pet project :)

Aavaas
  • 787
  • 1
  • 7
  • 16
  • Can somebody confirm that this is still the case(December 2018)? Unfortunately, it seems to me that 4 years after this answer, reverse image search didn't develop much – StLia Dec 05 '18 at 11:11
0

SerpApi, a third party solution, supports scraping Google reverse image. It's a paid API with a free trial.

Let's for example use this image of Danny DeVito: https://i.imgur.com/HBrB8p0.png

Example python code (available in other libraries also):

from serpapi import GoogleSearch

params = {
  "engine": "google_reverse_image",
  "google_domain": "google.com",
  "image_url": "https://i.imgur.com/HBrB8p0.png",
  "api_key": "secret_api_key"
}

search = GoogleSearch(params)
results = search.get_dict()

Example JSON response:

...
"image_results": [
  {
    "position": 1,
    "title": "Danny DeVito - Wikipedia",
    "link": "https://en.wikipedia.org/wiki/Danny_DeVito",
    "displayed_link": "https://en.wikipedia.org › wiki › Danny_DeVito",
    "snippet": "Daniel Michael DeVito Jr. (born November 17, 1944) is an American actor, comedian, director, producer, and screenwriter. He gained prominence for his ...",
    "cached_page_link": "https://webcache.googleusercontent.com/search?q=cache:EVb7AC9xwHYJ:https://en.wikipedia.org/wiki/Danny_DeVito+&cd=1&hl=en&ct=clnk&gl=us",
    "related_pages_link": "https://www.google.com/search?q=related:https://en.wikipedia.org/wiki/Danny_DeVito&sa=X&ved=2ahUKEwi7uom3wJ_xAhWxHDQIHct6DmQQHzAAegQIBhAQ"
  },
  {
    "position": 2,
    "title": "Danny DeVito - IMDb",
    "link": "https://www.imdb.com/name/nm0000362/",
    "displayed_link": "https://www.imdb.com › name",
    "snippet": "Danny DeVito, Actor: Matilda. Danny DeVito has amassed a formidable and versatile body of work as an actor, producer and director that spans the stage, ...",
    "cached_page_link": "https://webcache.googleusercontent.com/search?q=cache:c6r3v14HA7cJ:https://www.imdb.com/name/nm0000362/+&cd=2&hl=en&ct=clnk&gl=us"
  },
  {
    "position": 3,
    "title": "Danny DeVito - Simple English Wikipedia, the free encyclopedia",
    "link": "https://simple.wikipedia.org/wiki/Danny_DeVito",
    "displayed_link": "https://simple.wikipedia.org › wiki › Danny_DeVito",
    "thumbnail": "https://serpapi.com/searches/60cbb000ce87f8cca8f63685/images/9db7034fa3524b93ce0598116fd3b874800a67b8b9434cd54a009f2be5fd0809.jpeg",
    "thumbnail_destination_url": "https://upload.wikimedia.org/wikipedia/commons/thumb/2/21/Danny_DeVito_by_Gage_Skidmore.jpg/1200px-Danny_DeVito_by_Gage_Skidmore.jpg",
    "image_resolution": "1200 × 1427",
    "snippet": "Daniel Michael \" · Danny\" · DeVito, Jr. (born November 17, 1944) is an American actor, director, producer and screenwriter. He has starred in and directed a number ...",
    "cached_page_link": "https://webcache.googleusercontent.com/search?q=cache:2DR2mxjaZbsJ:https://simple.wikipedia.org/wiki/Danny_DeVito+&cd=32&hl=en&ct=clnk&gl=us",
    "related_pages_link": "https://www.google.com/search?q=related:https://simple.wikipedia.org/wiki/Danny_DeVito&sa=X&ved=2ahUKEwi7uom3wJ_xAhWxHDQIHct6DmQQHzAfegQIFhAQ"
  },
  ...
]

Check out the documentation for more details.

Disclaimer: I work at SerpApi.

Milos Djurdjevic
  • 364
  • 1
  • 11