Libraryless. Click here for Pure Java version (1061L/8K/23K).
1 | !752 |
2 | |
3 | answer { |
4 | if (matchStart("show", s, m)) { |
5 | S query = m.rest(); |
6 | S url = "http://ajax.googleapis.com/ajax/services/search/images?v=1.0&q=" + urlencode(query); |
7 | S json = loadPage(url); |
8 | |
9 | // json fumbling |
10 | Map data = jsonDecodeMap(json); |
11 | ret structure(data); |
12 | |
13 | /* |
14 | Map responseData = cast data.get("responseData"); |
15 | List<Map> _results = cast responseData.get("results"); |
16 | |
17 | new L<GoogleResult> results; |
18 | new StringBuilder buf; |
19 | for (int i = 0; i < _results.size(); i++) { |
20 | Map row = _results.get(i); |
21 | //print(structure(row)); |
22 | new GoogleResult r; |
23 | r.unescapedUrl = (S) row.get("unescapedUrl"); |
24 | r.cacheUrl = (S) row.get("cacheUrl"); |
25 | r.titleNoFormatting = htmldecode((S) row.get("titleNoFormatting")); |
26 | results.add(r); |
27 | //buf.append(r.titleNoFormatting + " [" + r.unescapedUrl + "]\n"); |
28 | buf.append(r.titleNoFormatting + "\n " + r.unescapedUrl + "\n"); |
29 | } |
30 | |
31 | //ret structure(results); |
32 | ret slackSnippet(buf); |
33 | */ |
34 | } |
35 | } |
Began life as a copy of #1002508
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
ID | Author/Program | Comment | Date |
---|---|---|---|
1209 | stefan | Deprecated API no more workee... | 2016-01-29 01:21:25 |
Snippet ID: | #1002509 |
Snippet name: | Direct Image Search Bot (broken) |
Eternal ID of this version: | #1002509/1 |
Text MD5: | 2246a1afbbefee3ff29cb7745a570206 |
Transpilation MD5: | dbb48db48c8d6a36cb5e5c230e559474 |
Author: | stefan |
Category: | javax |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-02-05 01:30:24 |
Source code size: | 1063 bytes / 35 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 873 / 893 |
Referenced in: | [show references] |