Github API - find follower count for all my followers

I can find the number of followers for a specific user, but I was wondering how best to find the number of followers each supporter has. I could of course go through each follower and then add up the follower counter, but that would be "expensive" and start pushing me towards the API rate limit.

Does anyone know how best to approach something like this?

+3


source to share


1 answer


You can use GraphQL API v4 for this, the following will fetch the first 100 subscribers with their counters counted:

{
  user(login: "bertrandmartel") {
    followers(first: 100) {
      totalCount
      edges {
        node {
          login
          followers(first: 0) {
            totalCount
          }
        }
        cursor
      }
      pageInfo {
        endCursor
        hasNextPage
      }
    }
  }
}

      



Then you need to go through the pagination with a value cursor

that determines after: "END_CURSOR_VALUE"

if hasNextPage

- true

.

0


source







All Articles