lib 1002510 // jsoup import org.jsoup.*; import org.jsoup.nodes.*; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; static S googleImageSearch_userAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1"; static int googleImageSearch_timeout = 10*1000; static S googleImageSearch(S q) ctex { ret googleImageSearch_elementURL(googleImageSearch_query(q).first()); } static L<S> googleImageSearch_multi(S q) ctex { ret map(f googleImageSearch_elementURL, googleImageSearch_query(q)); } static S googleImageSearch_elementURL(Element media) ctex { ret htmldecode(media.attr("abs:data-src")); } static Elements googleImageSearch_query(S q) ctex { ret googleImageSearch_loadPage(q).select("[data-src]"); } static Document googleImageSearch_loadPage(S q) ctex { S googleUrl = "https://www.google.com/search?tbm=isch&q=" + urlencode(q); print("Googling " + quote(q)); ret Jsoup.connect(googleUrl).userAgent(googleImageSearch_userAgent).timeout(googleImageSearch_timeout).get(); }
Began life as a copy of #1002511
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1004999 |
Snippet name: | googleImageSearch |
Eternal ID of this version: | #1004999/8 |
Text MD5: | e56175e95cb0e8699910d922bede0bd2 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-03-13 00:12:52 |
Source code size: | 1101 bytes / 32 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 707 / 900 |
Version history: | 7 change(s) |
Referenced in: | [show references] |