Skip to content

Instantly share code, notes, and snippets.

Created October 14, 2020 21:05
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mtliendo/012a84e5cbd3d74b1f178cbc43685266 to your computer and use it in GitHub Desktop.
retreive a list of followers from twitter
const cheerio = require('cheerio')
const axios = require('axios').default
async function fetchFollowerCounts(usernames) {
const followerData = => {
return axios.get(`${username}`).then((res) => {
const $ = cheerio.load(
const searchContext = `a[href='/${username}/followers']`
const followerCountString = $(searchContext)
return { user: username, followerCount: Number(followerCountString) }
return Promise.all(followerData)
fetchFollowerCounts(['mtliendo', '_mallorybrewer_'])
exports.handler = fetchFollowerCounts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment