download images from web api google

조회 수: 10 (최근 30일)
michael scheinfeild
michael scheinfeild 2015년 8월 30일
댓글: Walter Roberson 2015년 8월 30일
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

채택된 답변

Walter Roberson
Walter Roberson 2015년 8월 30일
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.

추가 답변 (1개)

michael scheinfeild
michael scheinfeild 2015년 8월 30일
편집: Walter Roberson 2015년 8월 30일
thank you but how to downloaded the images or read them ? i receive now : x=urelread(url) =
!doctype html><html dir="rtl" itemscope="" itemtype="http://schema.org/SearchResultsPage" lang="iw"><head><meta content="text/html; cha .....................
  댓글 수: 1
Walter Roberson
Walter Roberson 2015년 8월 30일
It looks to me as if the summary images presented show up in the HTML in the form
<img class="rg_i" src="
For example,
img class="rg_i" src="https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcRtZ2c-MyQtlEi5F_ydLMwQr0M9ER26_i7Y3Th1sS7nUIE2TrsIUUpLSJQ6" onload="google.aft&&google.aft(this)"><div class="rg_meta">{"tw":190, "th":266}</div></div></div><div class="rg_bb_label" style="font:18px/30px Arial,sans-serif" data-ved="0CB8QgzEoAGoVChMIoJnOieXRxwIVTyiICh3-pwd_"><div class="_Osc"><div class="_ucd">Clipart</div></div></div></div></a><a class="rg_fbl" data-query="tree drawings" data-title="Tree Drawings" href="/search?safe=off&biw=1652&bih=924&tbm=isch&q=tree+drawings&revid=1334743469&sa=X&ved=0CCEQ1QIoAWoVChMIoJnOieXRxwIVTyiICh3-pwd_" jsaction="fire.irc_fc;mouseover:str.hmov;mouseout:str.hmou"><div class="rg_bb rg_fb"><div class="rg_bb_i"><div class="rg_di rg_fr">
The href= would be the action from clicking on the image.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Google에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by