MATLAB: Download images from web api google

google api;web searchMATLAB

hi i want to search images of trees and download them as jpg i know there is google api how yo use it for images download

Best Answer

keyword = 'trees';
percent_escaped_keyword = regexprep(keyword, {' ', '&', '?', '<', '>'}, {'%20', '%26', '%3f', '%3c', '%3e'}); %it would be better to use some real routine for this
url = sprintf('https://www.google.com/search?q=site:images.google.com+%s&tbm=isch', precent_escaped_keyword);
Then you can urlread or urlwrite, and then you have the fun of trying to interpret the resulting HTML.
There is probably a real API, but it probably requires registration and an authentication token.
Related Question