2

This Stackoverflow answer states that Google's Custom Search API allows to search the entire web.

I don't really care about the result order, but would like to...

  • On my own website, using browser JavaScript or at least NodeJS, do a image search for the whole web using filters like these and process the result in JavaScript (displaying the result on my site)

  • also do a reverse image search (find images similar to a specific image URL)

To be clear, I do not want to a search based on the content of my website, but instead only show the worldwide results myself.

Is that possible in a legal way (not by scraping the Google website)?

Note I'm only interested in public domain / CC0 images (Google is able to filter images by license).

Community
  • 1
  • 1
Udo G
  • 12,572
  • 13
  • 56
  • 89

3 Answers3

0

If you're using Node.js (as the question is tagged), there is an npm module called fotology which does what you're asking. It even allows filtering by license:

let options = {
    size: "large", // large images only 
    language: "fr", // French 
    safe: true, // force safe search on 
    color: "white", // white cats only please
    rights: "cc_publicdomain" // Only public domain images
}

fotology("cats", options)
.then(function (imageURLs) {
    for (i in imageURLs)
        console.log imageURLs[i];
});

Disclaimer: I'm the author of that particular version of the module (original module didn't allow filtering by image license)

SlashmanX
  • 2,489
  • 18
  • 16
0

As this API is not available anymore, you can use our third-party service like SerpApi to scrape Google and get back structured JSON.

Example using the Node.js library:

var gsr = require('GoogleSearchResults')
let serp = new gsr.GoogleSearchResults("demo")
serp.json_with_images({
 q: "Cats Meme", 
 location: "Portland"
}, (result) => {
  console.log(result)
})
Hartator
  • 5,029
  • 4
  • 43
  • 73
0

The only image search API that I'm aware of today (2018) is the Bing API. I used Yahoo and Google in the past, but they both discontinued operations.

You get 1000 free searches per month, and it's about $5/1000 searches thereafter. I just implemented it last night; it works quite well.

Nico
  • 4,248
  • 1
  • 20
  • 19