Skip to content

Instantly share code, notes, and snippets.

@spences10
Created October 7, 2017 06:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spences10/74064d83235993b18bc656a6d795f595 to your computer and use it in GitHub Desktop.
Save spences10/74064d83235993b18bc656a6d795f595 to your computer and use it in GitHub Desktop.
List Twitter user account followers
const Twit = require('twit')
const config = require('./config')
const bot = new Twit(config)
const listOutFollowers = userName => {
bot.get(
'followers/ids',
{
screen_name: userName,
count: 200
},
function getData(err, data, response) {
for (let i = 0; i < data.ids.length; i++) {
console.log(data.ids[i])
}
if (data['next_cursor'] > 0)
bot.get(
'followers/ids',
{
screen_name: userName,
count: 200,
next_cursor: data['next_cursor']
},
getData
)
}
)
}
module.exports = listOutFollowers
listOutFollowers('droidscott')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment