2015-02-09 118 views
1

我可以通過使用Google自定義搜索引擎從JSON格式的Java項目中獲取圖像結果。然後我從Json文件中獲取圖像鏈接,並顯示來自android應用程序的圖像。我想以某種方式過濾我顯示給我的android應用程序的內容。Google自定義搜索API搜索圖像

所以我想通過圖片url搜索圖片並以Json格式獲得相似的圖片結果。我知道谷歌圖片搜索api,但它已被棄用。我也知道tineye API,但它需要付款,我更喜歡開源。

有沒有什麼辦法通過圖片url搜索圖片並獲得Json格式的結果?

回答

1

確切地不確定您的問題 - 但谷歌自定義搜索引擎可以返回圖片結果:例如唯一文件類型的結果png格式的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"); 

的搜索查詢詳情請參閱 https://developers.google.com/custom-search/docs/xml_results#startsp

+0

我的問題是有關反向圖像搜索。例如通過圖像搜索圖像,並得到類似的圖像結果json。 – fnkbz 2015-05-13 15:07:58

相關問題