download images from web api google

3 ビュー (過去 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 Center および File ExchangeWeb Services についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by