!7 lib 1002510 // jsoup import org.jsoup.*; import org.jsoup.nodes.*; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; static S userAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1"; answer { if (matchStart("show", s, m)) exceptionToUser { S query = m.rest().trim(); if (nempty(query)) ret findImage(query); } } public static String findImage(String question) ctex { ret urlShortener(findImageNoShorten(question)); } public static String findImageNoShorten(String question) ctex { String googleUrl = "https://www.google.com/search?tbm=isch&q=" + urlencode(question); Document doc1 = Jsoup.connect(googleUrl).userAgent(userAgent).timeout(10 * 1000).get(); Element media = doc1.select("[data-src]").first(); String finUrl = media.attr("abs:data-src"); ret htmldecode(finUrl); }