static BufferedImage googleImageSearchFirst(S q) { JWindow w = loadingAnim("Googling image: " + q); try { S html = str(googleImageSearch_loadPage(q)); S id = regexpFirstGroup("\"id\":\"(..............):\"", html); if (id == null) null; print("Image search: ID=" + id); S s = regexpFirstGroup("\\[\"" + id + ":\",\"data:image/(?:png|jpeg|gif);base64,([^\"]+)", html); if (s == null) { print("Image search: ID not found. Saving debug"); saveTextFile(prepareProgramFile(#1007145, "debug.html"), html); null; } try { ret decodeImage(base64decode(unquote("\"" + s + "\""))); } on fail { print("Tried to decode: " + quote(s)); } } finally { disposeWindow(w); } }
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: | 545 / 733 |
Version history: | 10 change(s) |
Referenced in: | #1007254 - Backup of googleImageSearchFirst - get one of the inlined images #1010230 - googleImageSearch as module #1016599 - googleImageSearchFirstFullImageURL - get URL of first full-size image #1018454 - youtubeSearch [dev.] |