Last active
May 27, 2022 10:29
-
-
Save jirawatee/81cffaf53a3fe6ecc93eccd69f91a79d to your computer and use it in GitHub Desktop.
Get followers by for loop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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