Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

35
LINES

< > BotCompany Repo | #1002509 // Direct Image Search Bot (broken)

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (1061L/8K/23K).

!752

answer {
  if (matchStart("show", s, m)) {
    S query = m.rest();
    S url = "http://ajax.googleapis.com/ajax/services/search/images?v=1.0&q=" + urlencode(query);
    S json = loadPage(url);
    
    // json fumbling
    Map data = jsonDecodeMap(json);
    ret structure(data);
    
    /*
    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);
    */
  }
}

Author comment

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

Comments [hide]

ID Author/Program Comment Date
1209 stefan Deprecated API no more workee... 2016-01-29 01:21:25

add comment

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: 869 / 889
Referenced in: [show references]