RE: STEEM编程练习记录 二 @ericet 73 about 4 years ago STEEM CN/中文 You are viewing a single comment's thread: View full context View direct parent 棒棒哒~ 粉丝那个就是只能显示100个 0 0 0.000 5 comments @lnakuma 69 about 4 years ago 还是你比我了解这些API。我还以为是一个自定义的数字呢🤣 0 0 0.000 Reply @ericet 73 about 4 years ago api最多还回1000个粉丝,如果要超过1000个,你要用Recursion 0 0 0.000 Reply @lnakuma 69 about 4 years ago 原来如此,每个iteration需要setTimeout吗? 0 0 0.000 Reply @ericet 73 about 4 years ago 不需要,这是我之前写的,你可以参考一下 function getFollowers(account, start = 0, limit = 1000, followers = []) { return new Promise((resolve, reject) => { steem.api.getFollowers(account, start, 'blog', limit, async function (err, result) { if (result.length > 1) { let newResult = []; result.forEach(follower => { if (follower.follower != start) { newResult.push(follower); } }); followers = [...followers, ...newResult]; let followersList = []; for (let i in newResult) { followersList.push(newResult[i].follower); } getFollowers(account, result[result.length - 1].follower, limit, followers) .then(resolve) .catch(reject); } else { resolve(followers); } }); }); } 0 0 0.000 Reply @lnakuma 69 about 4 years ago Cool。知道怎么弄了👏 👏 0 0 0.000 Reply
@lnakuma 69 about 4 years ago 还是你比我了解这些API。我还以为是一个自定义的数字呢🤣 0 0 0.000 Reply @ericet 73 about 4 years ago api最多还回1000个粉丝,如果要超过1000个,你要用Recursion 0 0 0.000 Reply @lnakuma 69 about 4 years ago 原来如此,每个iteration需要setTimeout吗? 0 0 0.000 Reply @ericet 73 about 4 years ago 不需要,这是我之前写的,你可以参考一下 function getFollowers(account, start = 0, limit = 1000, followers = []) { return new Promise((resolve, reject) => { steem.api.getFollowers(account, start, 'blog', limit, async function (err, result) { if (result.length > 1) { let newResult = []; result.forEach(follower => { if (follower.follower != start) { newResult.push(follower); } }); followers = [...followers, ...newResult]; let followersList = []; for (let i in newResult) { followersList.push(newResult[i].follower); } getFollowers(account, result[result.length - 1].follower, limit, followers) .then(resolve) .catch(reject); } else { resolve(followers); } }); }); } 0 0 0.000 Reply @lnakuma 69 about 4 years ago Cool。知道怎么弄了👏 👏 0 0 0.000 Reply
@ericet 73 about 4 years ago api最多还回1000个粉丝,如果要超过1000个,你要用Recursion 0 0 0.000 Reply @lnakuma 69 about 4 years ago 原来如此,每个iteration需要setTimeout吗? 0 0 0.000 Reply @ericet 73 about 4 years ago 不需要,这是我之前写的,你可以参考一下 function getFollowers(account, start = 0, limit = 1000, followers = []) { return new Promise((resolve, reject) => { steem.api.getFollowers(account, start, 'blog', limit, async function (err, result) { if (result.length > 1) { let newResult = []; result.forEach(follower => { if (follower.follower != start) { newResult.push(follower); } }); followers = [...followers, ...newResult]; let followersList = []; for (let i in newResult) { followersList.push(newResult[i].follower); } getFollowers(account, result[result.length - 1].follower, limit, followers) .then(resolve) .catch(reject); } else { resolve(followers); } }); }); } 0 0 0.000 Reply @lnakuma 69 about 4 years ago Cool。知道怎么弄了👏 👏 0 0 0.000 Reply
@lnakuma 69 about 4 years ago 原来如此,每个iteration需要setTimeout吗? 0 0 0.000 Reply @ericet 73 about 4 years ago 不需要,这是我之前写的,你可以参考一下 function getFollowers(account, start = 0, limit = 1000, followers = []) { return new Promise((resolve, reject) => { steem.api.getFollowers(account, start, 'blog', limit, async function (err, result) { if (result.length > 1) { let newResult = []; result.forEach(follower => { if (follower.follower != start) { newResult.push(follower); } }); followers = [...followers, ...newResult]; let followersList = []; for (let i in newResult) { followersList.push(newResult[i].follower); } getFollowers(account, result[result.length - 1].follower, limit, followers) .then(resolve) .catch(reject); } else { resolve(followers); } }); }); } 0 0 0.000 Reply @lnakuma 69 about 4 years ago Cool。知道怎么弄了👏 👏 0 0 0.000 Reply
@ericet 73 about 4 years ago 不需要,这是我之前写的,你可以参考一下 function getFollowers(account, start = 0, limit = 1000, followers = []) { return new Promise((resolve, reject) => { steem.api.getFollowers(account, start, 'blog', limit, async function (err, result) { if (result.length > 1) { let newResult = []; result.forEach(follower => { if (follower.follower != start) { newResult.push(follower); } }); followers = [...followers, ...newResult]; let followersList = []; for (let i in newResult) { followersList.push(newResult[i].follower); } getFollowers(account, result[result.length - 1].follower, limit, followers) .then(resolve) .catch(reject); } else { resolve(followers); } }); }); } 0 0 0.000 Reply @lnakuma 69 about 4 years ago Cool。知道怎么弄了👏 👏 0 0 0.000 Reply
还是你比我了解这些API。我还以为是一个自定义的数字呢🤣
api最多还回1000个粉丝,如果要超过1000个,你要用Recursion
原来如此,每个iteration需要setTimeout吗?
不需要,这是我之前写的,你可以参考一下
Cool。知道怎么弄了👏 👏