1 | static BufferedImage googleImageSearchFirst(S q) { |
2 | JWindow w = loadingAnim("Googling image: " + q); |
3 | try { |
4 | S html = str(googleImageSearch_loadPage(q)); |
5 | S id = regexpFirstGroup("\"id\":\"(..............):\"", html); |
6 | if (id == null) null; |
7 | print("Image search: ID=" + id); |
8 | S s = regexpFirstGroup("\\[\"" + id + ":\",\"data:image/(?:png|jpeg|gif);base64,([^\"]+)", html); |
9 | if (s == null) { |
10 | print("Image search: ID not found. Saving debug"); |
11 | saveTextFile(prepareProgramFile(#1007145, "debug.html"), html); |
12 | null; |
13 | } |
14 | try { |
15 | ret decodeImage(base64decode(unquote("\"" + s + "\""))); |
16 | } on fail { |
17 | print("Tried to decode: " + quote(s)); |
18 | } |
19 | } finally { |
20 | disposeWindow(w); |
21 | } |
22 | } |
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
Snippet ID: | #1007251 |
Snippet name: | googleImageSearchFirst - get first inlined image |
Eternal ID of this version: | #1007251/11 |
Text MD5: | e9d8ade97808ee4741a5c3ed8415ce85 |
Author: | stefan |
Category: | javax / networking |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-08-15 20:14:12 |
Source code size: | 759 bytes / 22 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 546 / 735 |
Version history: | 10 change(s) |
Referenced in: | [show references] |