Libraryless. Click here for Pure Java version (457L/4K/12K).
1 | !747 |
2 | |
3 | m { |
4 | // in |
5 | static S query = "Java class declarations"; |
6 | |
7 | // intermediate |
8 | static S url, json; |
9 | |
10 | // out |
11 | static O data; |
12 | static new List<GoogleResult> results; |
13 | |
14 | static class GoogleResult { |
15 | S url, cacheurl, title; |
16 | } |
17 | |
18 | p { |
19 | url = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=" + urlencode(query); |
20 | json = loadPage(url); |
21 | //print(json); |
22 | //print(); |
23 | data = jsonDecode(json); |
24 | //print(structure(data)); |
25 | |
26 | O responseData = ((Map) data).get("responseData"); |
27 | //print(structure(responseData)); |
28 | |
29 | List<Map> _results = cast ((Map) responseData).get("results"); |
30 | //print(structure(_results)); |
31 | |
32 | for (int i = 0; i < _results.size(); i++) { |
33 | Map row = _results.get(i); |
34 | //print(structure(row)); |
35 | new GoogleResult r; |
36 | r.url = (S) row.get("unescapedUrl"); |
37 | r.cacheurl = (S) row.get("cacheUrl"); |
38 | r.title = (S) row.get("titleNoFormatting"); |
39 | print(structure(r)); |
40 | results.add(r); |
41 | } |
42 | } |
43 | } |
download show line numbers debug dex old transpilations
Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, liwcxgsjrgqn, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1000857 |
Snippet name: | Google search test |
Eternal ID of this version: | #1000857/1 |
Text MD5: | 8bfe79fe615f0ecb171bbe8a2904cf30 |
Transpilation MD5: | 57277ec6daeb4225f169c6974791bc91 |
Author: | stefan |
Category: | javax |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-08-30 18:06:39 |
Source code size: | 1049 bytes / 43 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 753 / 869 |
Referenced in: | [show references] |