Blog

How to Scrape Instagram Followers | With Python or No-Code

By October 4, 2020 April 21st, 2021 No Comments

This article teaches you how to scrape Instagram followers with and without python. 

Important note: Please be advised that automatically scraping Instagram is against their terms of service.

This is just an educational resource and for those of you who don’t have the time, resources, and want to be 100% on the legal side of things, get in touch with us and just buy email addresses from Instagram.

If you have any additional questions or want to get verified customer email lists in 24 hours (no matter how long the email list is) feel free to reach out using this link

There will be two parts to this article:

  1. How to scrape Instagram followers with Python – For developers
  2. How to scrape Instagram followers with other tools – For non-technical people

1. How to scrape Instagram followers with Python

Scraping anything is really best done with Python. So if you don’t know Python and yet you somehow landed on this article, I am sure you will find your way around it. It’s super easy to do so. Scraping Instagram followers with Python comes down to two main things:

  1. Scraping the usernames (or user IDs) that follow a given profile (yours, your competitor’s followers, etc), hashtag, or location (yes you can do that too)
  2. Scraping additional details (email, category, etc) for all usernames/ids collected

How to scrape an Instagram follower list

For a) here is a code sample written by a user named @tonoli on Github:

from datetime import datetime
from modules import compare
from modules import file_io
from modules import stats

from modules.scraper import Scraper
from modules.utils import ask_input, ask_multiple_option


groups = ['followers', 'following']

# Ask for input
target = ask_input('Enter the target username: ')
group = ask_multiple_option(options = groups + ['both']);
print('\nEnter your Instagram credentials')
username = ask_input('Username: ')
password = ask_input(is_password = True)

def scrape(group):
    differs = False
    scraper = Scraper(target)
    startTime = datetime.now()

    scraper.authenticate(username, password)
    users = scraper.get_users(group, verbose=True)
    scraper.close()

    last_users = file_io.read_last(target, group)
    if last_users:
        differs = bool(compare.get_diffs(users, last_users))

    if (differs or not last_users):
        file_io.store(target, group, users)
    # Stats
    stats.numbers(len(users), scraper.expected_number)
    if (differs): stats.diff(users, last_users)
    print('Took ' + str(datetime.now() - startTime))

if (group == 'both'):
    for group in groups:
        scrape(group)
else:
    scrape(group)

This should be enough to gather a list of all Instagram followers for a specific account. PLEASE keep in mind that accounts with a huge following are a lot harder to scraping using this method. That’s because Instagram has limits that you need to respect and they are somewhat super hard to crack. But for a small account, it should do the job. 

You need to have Python 3 and PIP installed. You also need to have Chrome installed as Selenium uses the chromedriver contained in the drivers’ folder. Finally, you’ll need your Instagram credentials to log in. At this time the dialog with the list of followers cannot be opened as an anonymous user.

How to scrape Instagram followers emails (+ additional details)

If you only needed to export a  list of Instagram usernames, that follow a specific account, then you’ll be done with the first part. But if you want to market to those people, then you’ll need to scrape additional details, like email addresses, phone numbers, category of the profile, etc.

This is a bit harder to do as you’ll need Instagram accounts and log them through the mobile API. Here is a sample on how to do that with the browser, but again, you are limited, and PLEASE don’t do any scraping with your main Instagram account:

from requests import get
from bs4 import BeautifulSoup
import sys
import re
import json
from datetime import datetime

URL = 'https://www.instagram.com'

def get_data(username):
    url = '%s/%s/' % (URL, username)
    page = get(url, timeout=5)
    soup = BeautifulSoup(page.content, 'html.parser')
    data = soup.find_all('meta', attrs={'property': 'og:description'})
    photo = soup.find_all('meta', attrs={'property': 'og:image'})
    text = data[0].get('content').split()
    retext = re.findall(
        '<script type="text\/javascript">([^{]+?({.*profile_pic_url.*})[^}]+?)<\/script>', str(soup))[0][1]
    jsontext = json.loads(retext)['entry_data']['ProfilePage'][0]
    print(jsontext)
    media_likes = 0
    media_comments = 0
    media_views = 0
    media_count = 0
    media_videos = 0
    media_list = []
    for media in jsontext['graphql']['user']['edge_owner_to_timeline_media']['edges']:
        media_count += 1
        media_likes += media['node']['edge_liked_by']['count']
        media_comments += media['node']['edge_media_to_comment']['count']
        if media['node']['is_video']:
            media_videos += 1
            media_views += media['node']['video_view_count']
            media_list.append({
                'id': '2042452950535483363',
                'img_url': media['node']['thumbnail_src'],
                'date_posted': datetime.fromtimestamp(media['node']['taken_at_timestamp']),
                'likes': media['node']['edge_liked_by']['count']  
            })
        else:
            media_list.append({
                'id': '2042452950535483363',
                'img_url': media['node']['thumbnail_src'],
                'date_posted': datetime.fromtimestamp(media['node']['taken_at_timestamp']),
                'likes': media['node']['edge_liked_by']['count'],
            })
    media_video_like_engagement = 0
    media_video_comment_engagement = 0
    if media_videos != 0:
        media_video_like_engagement = (
            ig_tv_likes / ig_tv_videos) / (ig_tv_views / ig_tv_videos)

    return ....

Full code available here.

If you don’t want to bother with that, you can just upload the list of usernames you already got to our API and we’ll enrich it and give you the email address if we have it. It’s free to sign up and you’ll also get 1500 credits.

Export Instagram followers (No-Code)

If you want to only export your Instagram followers and not scrape, then IGExport is an extension developed that lets you easily export your followers. 

Here are some of its features:

  • Scraping less than 500 followers is completely FREE
  • The maximum amount of followers you can scrape with this tool is 50 000 users
  • For every scraped follower you get their:
    • User ID & Username
    • Full Name
    • Whether you followed them back
    • Is the account verified
    • URL to the profile
    • Avatar URL

How to scrape Instagram followers with IGExport

  1. Add to Chrome
  2. Sign in with your Google Account
  3. Insert the Instagram username of the profile whose followers you want to get
  4. Click Export Followers

Alternatives?

If this one doesn’t work for you, you can check out some other Instagram scrapers like WebRobots, or Scrapy Gram. 

Again, if you don’t want to do any work at all, we have this solution done for you over at Influencers Club. Just fill in the form below and let’s rock!
We’ve heavily invested in our research team that vetts Instagram creators + influencers that personally sign up to be in our database. This way we help you be 100% on the safe side, both from an Instagram ToS perspective and GDPR / CCPA / ACMA.

If you have any additional questions or want to get verified customer email lists in 24 hours (no matter how long the email list is) feel free to reach out using this link

How (and why) to scrape Instagram data

By following a certain Instagram influencer people reveal their interests. 

For example, I’m following the number 1 chess player in the world Magnus Carlsen. Even if you don’t know anything else about me, you can guess that I like playing chess or at least am interested in chess. 

A business that sells chess clocks might make a small fortune by extracting & reaching out to all of 340k followers of Magnus Carlsen since most of these people are probably interested in chess. 

To find Influencers that your audience follows, answer these questions:

1. What’s the most common interest & behavior among your current customers?

Gaming, traveling, reading books, fitness, blogging, etc… 

After you determine the ones that are closest to your customer’s interests, find the most popular influencers on that topic. To do that visit the following article:

Then you can talk to our team and our research team can get you the emails (along with 27 other data points) of everyone following that influencer. Check out our pricing on this link.

2. What’s the most common characteristic among your customers?

For example, if you’re selling beard oil products (and you can’t find an influencer around that topic) you can still reach everyone that’s growing a beard. How?

Instagram #Hashtags 

People use hashtags to describe their Instagram posts & if you click on a certain hashtag, you can see everyone that used that hashtag. 

As you can see in the image above, there are +600 000 posts with the hashtag #beardlifestyle. Sending a promo email of a new beard oil line to all of these people you will get new customers no matter what. 

If you’re still not sure what influencers your audience follows or the hashtags that they use, you can always go after the followers of your competitors.

If you have any additional questions or want to get verified customer email lists in 24 hours (no matter how long the email list is) feel free to reach out using this link

Email Or Run Targeted Facebook Ads Against Your Competitor Followers 

50 percent of all our clients reach out to us with one goal in mind. They want to go after the customers of their competitors. It’s the safest option to contact people that you know are interested in the products or services you offer. 

For example, imagine what would Rebook do if they had email addresses of everyone that follows nike_shoes (235k followers). 

What Can You Do With Emails From a List of Instagram Followers?

  1. Email Marketing Campaigns

The most obvious one is also the most profitable. If you’re familiar with the craft of sending bulk emails then you’re surely going to love this. Having emails of targeted people turns out the be one of the biggest marketing revelations of 2020. 

One example is the impact of this strategy on the CBD industry. Several CBD giants are allocating all of their advertising budgets to purchasing email database of Instagram followers (ps. we know this because we provide them the data). CBD clients experience an average x12 ROI, meaning they made $12  for every $ spent.

And that’s not the case only with CBD. Any business that has an online store can benefit from having contact info of people that are interested or consume products they sell. 

Another success story is an eCommerce brand that sells bikinis using only our emails. Without any previous experience in sending emails at scale, they managed to figure that out and reach an incredible 2.5M in ARR. Read here about their whole setup for sending 100k cold emails per day.

  1. Custom Audiences on Facebook 

Sending that amount of emails at once can be a pain, so you might consider plugging the emails in as custom audiences on Facebook and run ads against your competitor followers?

  1. Resell or Rent the Customer Email Lists Yourself

This has become a regular practice among marketing agencies that we collaborate with. They convince any client with large budgets to buy email lists, and since they don’t sign any agreements the agency keeps the lists for themselves, reselling it to other clients or renting. Pretty neat!

Scrape Instagram Followers

Hope this article helped people that wanted to find a way to export Instagram followers as well as businesses that want to go after the followers of a certain Instagram profile.

If you have any additional questions or want to get verified customer email lists in 48 hours, completely verified, feel free to reach out using this link

Leave a Reply

Hey, wait!

Before you go, check out a free data sample with the 20+ data points on every contact we have.