Skip to content

Instantly share code, notes, and snippets.

@jirawatee
Last active May 27, 2022 10:29
Show Gist options
  • Save jirawatee/81cffaf53a3fe6ecc93eccd69f91a79d to your computer and use it in GitHub Desktop.
Save jirawatee/81cffaf53a3fe6ecc93eccd69f91a79d to your computer and use it in GitHub Desktop.
Get followers by for loop
const main = async() => {
const valueArray = []
let result = {}
let next = ''
// 23794 คือค่า targetedReaches ที่ได้มาจาก Get Number of Followers API
const rounds = Math.ceil(23794/1000);
for (i = 0; i < rounds; i++) {
result = await getFollowerIds(next)
for (const userId of result.userIds) {
valueArray.push(userId)
}
next = result.next
}
console.log(valueArray.length)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment