Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //This is right after getPosts()
- let authorURLS = [];
- let LinkKarmas = [];
- let CommentKarmas = [];
- let jsonProfiles = {};
- profiles = [];
- async function finish(){
- await getPosts(search);
- console.log(authors.length)
- var i;
- for(i = 0; i< authors.length; i++){
- authorURLS[i] ="https://www.reddit.com/user/" + authors[i] + "/about.json";
- console.log(authorURLS[i]);
- getKarmas(authorURLS)
- function getKarmas(authorURLS){
- let authorProfileLink = authorURLS[i];
- console.log(authorProfileLink);
- return fetch(authorProfileLink)
- .then(res => res.json())
- .then(profiles => {
- // Get request is done
- jsonProfiles = profiles;
- console.log("This is the raw result json object:");
- console.log(jsonProfiles);
- // Extract and print posts
- profiles = jsonProfiles.data.children.map((o) => o.data);
- console.log("This is the profile for this author:");
- console.log(profiles);
- // Extract and print authors
- LinkKarmas = jsonProfiles.data.children.map((o) => o.data.link_karma);
- console.log("This is the link karma for this person:");
- console.log(LinkKarmas);
- CommentKarmas = jsonPost.data.children.map((o) => o.data.title);
- console.log("This is the comment karma for this person:");
- console.log(CommentKarmas);
- });
- }
- }
- }
- finish();
Advertisement
Add Comment
Please, Sign In to add comment