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

16
LINES

< > BotCompany Repo | #1004103 // loadMediumJSON

JavaX fragment (include)

sbool loadMediumJSON_verbose;
static int loadMediumJSON_timeout = 60*1000;

// accepts raw username and "@username"
static Map<S, O> loadMediumJSON(S username) {
  S html = loadPageWithUserAgentAndTimeout("https://medium.com/" + addPrefix("@", username), "Mac Safari", loadMediumJSON_timeout);
  if (loadMediumJSON_verbose) print(html);
  
  S prefix = [[window["obvInit"](]];
  int i = indexOf(html, prefix);
  if (i < 0) null;
  int j = indexOf(html, "\n", i);
  if (j < 0) null;
  S json = dropSuffix(")", trim(substring(html, i+l(prefix), j)));
  ret jsonDecodeMap(json);
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1004103
Snippet name: loadMediumJSON
Eternal ID of this version: #1004103/1
Text MD5: 9e1677b26e92c94257cd774850479e12
Author: stefan
Category: javax / networking
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-12-28 17:52:27
Source code size: 592 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 538 / 504
Referenced in: [show references]