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

13
LINES

< > BotCompany Repo | #1016599 // googleImageSearchFirstFullImageURL - get URL of first full-size image

JavaX fragment (include)

1  
sS googleImageSearchFirstFullImageURL(S q) {
2  
  temp tempLoadingAnim("Googling image: " + q);
3  
  S html = str(googleImageSearch_loadPage(q));
4  
  S id = regexpFirstGroup("\"id\":\"(..............):\"", html);
5  
  if (id == null) null;
6  
  print("Image search: ID=" + id);
7  
  S s = regexpFirstGroup("\"id\":\"" + id + ":\"[^}]+\"ou\":\"([^\"]+)\"", html);
8  
  if (s == null) {
9  
    print("Image search: ID not found. Saving debug");
10  
    saveTextFile(prepareProgramFile(#1007145, "debug.html"), html);
11  
  }
12  
  ret s;
13  
}

Author comment

    {"cl":21,"clt":"n","cr":21,"ct":6,"id":"4PC-lf82-aBZ8M:","isu":"paperlief.com","itg":0,"ity":"jpg","oh":786,"ou":"http://paperlief.com/images/llama-wallpaper-2.jpg","ow":1365,"pt":"Llam HD Wallpaper, Background Images","rh":"paperlief.com","rid":"aq70YKw0BAg38M","rt":0,"ru":"http://paperlief.com/lama/llama-wallpaper-2.html","s":"Llama","st":"Wallpapers","th":170,"tu":"https://encrypted-tbn0.gstatic.com/images?q\u003dtbn:ANd9GcQSaGZ4CXvVr9MWeuMbttex1qv9H52N5fz1r5njOdtZkU9GT8wHww","tw":296}


Began life as a copy of #1007251

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1016599
Snippet name: googleImageSearchFirstFullImageURL - get URL of first full-size image
Eternal ID of this version: #1016599/2
Text MD5: ae76fd59560a16204b075cad67b99007
Author: stefan
Category: javax / networking
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-06-24 19:12:20
Source code size: 514 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 377 / 414
Version history: 1 change(s)
Referenced in: [show references]