How I Went From 0 To 50 GitHub Followers In Under A Week

A short, simple, and maybe a bit unethical way of getting potentially hundreds of GitHub followers in a week with minimal to no effort.

How I Went From 0 To 50 GitHub Followers In Under A Week

GitHub, like all social media, is a numbers game. To get the most, likes, hearts, snaps, upvotes or in GitHub case followers and stars. Whilst a simple "like" on it's own on a YouTube video may mean nothing. On GitHub stars and followers are worth their weight in gold, and each one isn't the easiest to come by, unlike YouTube and many other social media platforms when a GitHub user stars your repository, they deem your project to be worthy of recognition and praise. They've either used or read the code you've developed and have decided to star or watch it to follow its progression later, for interest or their gain. A star on GitHub is a sign of recognition, respect and each one has a user proudly showing that they've used your project.

So with GitHub followers and stars being hard to come by, with the benefits being immense, allowing your open-source projects to gain traction getting both users and other fellow developers on board, how do we obtain either?

With GitHub stars, the answer is a bit too nuisance to determine, but it more or less ends up being to develop good open-source projects. But with followers, the simplest solutions usually lead to the best outcomes. You could either spend time developing online content including; YouTube videos, Blog Posts, technical breakdowns, Podcasts, and other social media content with the hope that they follow you from providing good content OR just follow them and hope that they'll (maybe) follow us back in return.

By extending an olive branch so to speak to the user, by giving them a follow. We approach the user as friendly, open to chat, and somewhat likable, as a result on a case-to-case basis some users may feel obligated to follow back. By exploiting this human behavior, even if a small percentage of people do follow back (1-2%) by following hundreds, or if scalability permits, thousands of users, we can still net potentially hundreds of users daily from doing minimal to no work.

Whilst it all sounds like fun and games following all new users who come up in our feeds manually, after doing it for a bit it does get very time-consuming and boring. Why spend time grinding hours upon hours to get virtual fake followers, when you can automate it, allowing you to spend your time developing quality open-source projects.

Introducing Selenium - How To Automate The Boring Things With Python

Introducing Selenium! ...and python. Whilst Python isn't my preferred programming language, far from it. I am well-versed in it and at times, whilst I dislike programming in it, its speed outweighs any hatred I have towards it. Whilst not ideal for any heavy web-scraping or time-sensitive web-automation tasks, Selenium is a fairly lightweight and programmable browser automation tool. Through just under 50 lines of code, we're easily able to get a Mozilla Firefox browser to be run headlessly allowing us to log into GitHub, access some of the most followed users pages, and follow their users back. By following such a huge array of users, who tend to follow people as a whole, we're able to quickly amass a huge following list of users, and from human behavior have some of them follow us back.

from selenium import webdriver
from selenium.webdriver.firefox.options import Options
import time

options = Options()
options.headless = True

print("[INFO]: Running")
userName = "Enter Github Username Here!"
password = "Enter Github Password Here!"

driver = webdriver.Firefox(options=options)
driver.get("http://github.com/login")

usr = driver.find_element_by_id("login_field")
passwd = driver.find_element_by_id("password")
usr.send_keys(userName)
passwd.send_keys(password)
time.sleep(0.5)
login_form = driver.find_element_by_xpath("//input[@value='Sign in']")
login_form.click()
time.sleep(1)

with open("githubUsers.txt", "r") as ins:
    userArray = []
    for line in ins:
        userArray.append(line)

for user in userArray:
    loop = True
    driver.get("https://github.com/{}/followers".format(user))
    while(loop==True):
        try:
            next = driver.find_element_by_link_text('Next')
            driver.get(next.get_attribute("href"))
        except:
            loop = False

        time.sleep(0.5)

        follow = driver.find_elements_by_xpath("//button[@aria-label='Follow this person']")
        try:
            for i in follow:
                i.submit()
        except:
            pass
        time.sleep(0.5)

driver.close()

This does lead to its issues, however, by following so many users, but having so few users following us back. It does make our profile look a bit suspicious of being automated, or worse.. desperate. As a result, we can also unfollow these users after getting them to follow us by making another script to bulk unfollow everyone on our follower's list once ready. Just make sure to create a list of users you do genuinely follow as all followers, they included will be erased.

from selenium import webdriver
from selenium.webdriver.firefox.options import Options
import time

options = Options()
options.headless = True

print("[INFO]: Running")
userName = "Enter Github Username Here!"
password = "Enter Github Password Here!"

driver = webdriver.Firefox(options=options)
driver.get("http://github.com/login")

usr = driver.find_element_by_id("login_field")
passwd = driver.find_element_by_id("password")
usr.send_keys(userName)
passwd.send_keys(password)
time.sleep(0.5)
login_form = driver.find_element_by_xpath("//input[@value='Sign in']")
login_form.click()
time.sleep(1)

loop = True
driver.get("https://github.com/{}/following".format(userName))
while(loop==True):
    try:
        next = driver.find_element_by_link_text('Next')
        driver.get(next.get_attribute("href"))
    except:
        loop = False

    time.sleep(0.5)

    unfollow = driver.find_elements_by_xpath("//input[@aria-label='Unfollow this person']")

    try:
        for i in unfollow:
            i.submit()
            time.sleep(0.1)
    except:
        pass

    time.sleep(2)

driver.close()

After testing both scripts out for two hours straight before calling it quits, I ended with a total of following 326 people, with after a day having 53 users following me back.

Whilst after unfollowing all these users I did get a bit of a drop-off, netting me back down to 46. If repeated on a huge and more long-term scale this method of following users, and later unfollowing them could be deemed as a success, netting huge amounts of followers in a small time frame with minimal effort. Whilst I wouldn't recommend this method as GitHub may or may not opt to ban or restrict your account, it is definitely a viable option at the time of writing this post and it is something to consider in the future in regards to how one could expand their follower base.

To view the source code of this project or to use it yourself, it is available on GitHub here:

ShaanCoding/githubFollowBot
An Automated Following Bot For Github. Contribute to ShaanCoding/githubFollowBot development by creating an account on GitHub.