fnkbz
fnkbz

Reputation: 1219

Google custom search api search images by image

I can get images results from a java project in Json format by using a Google custom search engine. Then I get the image link from the Json file and I show the images from an android app. I want somehow to filter the content that I show to my android app.

So I want to search images by image url and get similar image results in Json format. I am aware of Google image search api but it is deprecated. also I am aware of tineye api but it requires payment and I prefer an opensource one.

Is there any way to search images by image url and get results in Json format?

Upvotes: 2

Views: 3353

Answers (1)

NottmTony
NottmTony

Reputation: 456

Unsure of your question exactly - but the google custom search engine can return image results : e.g. only results of filetype .png for a search query of java

String newURL = "https://www.googleapis.com/customsearch/v1?key=<YOUR API KEY>&cx=<your google custom search engine>&q=java&as_filetype=png";

// Create a new RestTemplate instance
RestTemplate restTemplate = new RestTemplate();

// Add the String message converter
restTemplate.getMessageConverters().add(new StringHttpMessageConverter());

// Make the HTTP GET request, marshaling the response to a String
String googleRestResult = restTemplate.getForObject(newURL, String.class, "Android");

See for details https://developers.google.com/custom-search/docs/xml_results#startsp

Upvotes: 1

Related Questions