Python – Who follows you at GitHub?

Who follows you? Who follows your followers? And who follows the followers of your followers? And what about the next level?

These are pretty interesting question actually. With easy answers, if you are interested only in GitHub. The GitHub team have provided their API (application programming interface) for anyone, interested to find out how many people in total follow the followers of their followers. To access the API, just go to this site here. You may change the user name to obtain whatever information you need.

python-logo-master-v3-TM

So what I did? A GitHub crawler, making a graph of the followers of your followers and going as many levels as you want (or you are allowed to by GitHub). I have tested it with 6 levels and this is what I got:

levels

What does it tells us? Pretty much, it tells us, that the followers of our followers up to level 5 are in total 3011 unique people. (The levels are reversed, e.g. 6 is 1, 5 is 2 and so on.) Can we see them? Do we know them? Definitely, that is why the crawler is actually built for. Here are the followers of the first 19 followers in a dictionary format – as you may see, vitoshacademy is followed by ony 3 people (and one of them is me with my other account), so feel free to follow me in GitHub 🙂

Followers

Finally what the code does?

  • Using the library requests of Python, it generates a Graph as a dictionary from your followers;
  • The key is the name of the user, the values are its followers;
  • An interesting feature for printing is added;

How the code looks like? Well, the unoptimized version looks like this:

Enjoy it! 🙂

Tagged with: , , , ,