sclass MediumPost { S title, url, postID; long updatedAt; *() {} *(S *title, S *url) {} *(S *title, S *url, S *postID) {} *(S *title, S *url, S *postID, long *updatedAt) {} } static L<MediumPost> getMediumPosts() { ret getMediumPosts("stefanreich"); } static L<MediumPost> getMediumPosts(S username) { Map<S, O> data = loadMediumJSON(username); new L<MediumPost> lPosts; Map references = (Map) data.get("references"); Map<S, Map> posts = (Map) references.get("Post"); for (S postID : keys(posts)) { Map post = posts.get(postID); S uniqueSlug = getString(post, "uniqueSlug"); S link = "https://medium.com/@" + username + "/" + uniqueSlug; S title = or2(getString(post, "title"), "?"); long updatedAt = (long) post.get("updatedAt"); lPosts.add(new MediumPost(title, link, postID, updatedAt)); //psl(post); } ret reversedList(sortedByField(lPosts, "updatedAt")); }
Began life as a copy of #1004101
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, jtubtzbbkimh, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1004104 |
Snippet name: | getMediumPosts - get someone's last posts at medium.com |
Eternal ID of this version: | #1004104/1 |
Text MD5: | 634748b2cddb2a307d81901b7ada9778 |
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:51:58 |
Source code size: | 961 bytes / 32 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 552 / 516 |
Referenced in: | [show references] |