Libraryless. Click here for Pure Java version (5775L/41K/130K).
!752 p { bot(); } static class GoogleResult { S unescapedUrl, cacheUrl, titleNoFormatting; } answer { if (matchStart("quickgoogle", s, m)) { S query = m.rest(); S url = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=" + urlencode(query); S json = loadPage(url); // json fumbling Map data = jsonDecodeMap(json); Map responseData =cast data.get("responseData"); List<Map> _results = cast responseData.get("results"); new L<GoogleResult> results; new StringBuilder buf; for (int i = 0; i < _results.size(); i++) { Map row = _results.get(i); //print(structure(row)); new GoogleResult r; r.unescapedUrl = (S) row.get("unescapedUrl"); r.cacheUrl = (S) row.get("cacheUrl"); r.titleNoFormatting = htmldecode((S) row.get("titleNoFormatting")); results.add(r); //buf.append(r.titleNoFormatting + " [" + r.unescapedUrl + "]\n"); buf.append(r.titleNoFormatting + "\n " + r.unescapedUrl + "\n"); } //ret structure(results); ret slackSnippet(buf); } }
Began life as a copy of #1000857
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment