<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Braydon Buckner</title>
    <description>The latest articles on DEV Community by Braydon Buckner (@braydon_buckner_f0e01f8673a).</description>
    <link>https://dev.to/braydon_buckner_f0e01f8673a</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F571556%2Fb56ef338-8957-49d3-8acd-040c48323deb.jpg</url>
      <title>DEV Community: Braydon Buckner</title>
      <link>https://dev.to/braydon_buckner_f0e01f8673a</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/braydon_buckner_f0e01f8673a"/>
    <language>en</language>
    <item>
      <title>Scrape Instagram Followers | Extract Follower Data (2021) </title>
      <dc:creator>Braydon Buckner</dc:creator>
      <pubDate>Fri, 05 Mar 2021 07:31:12 +0000</pubDate>
      <link>https://dev.to/braydon_buckner_f0e01f8673a/scrape-instagram-followers-extract-follower-data-2021-1o3l</link>
      <guid>https://dev.to/braydon_buckner_f0e01f8673a/scrape-instagram-followers-extract-follower-data-2021-1o3l</guid>
      <description>&lt;p&gt;&lt;strong&gt;Important note&lt;/strong&gt;: Please be advised that automatically scraping follower data from Instagram is against their terms of service.&lt;/p&gt;

&lt;p&gt;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, &lt;a href="https://influencers.club/?utm_source=dev.to&amp;amp;utm_medium=scrape-insta-followers"&gt;get in touch with Influencers Club&lt;/a&gt; and just buy email addresses from Instagram followers.&lt;/p&gt;

&lt;p&gt;A lot of you want to know how to scrape data from your Instagram followers or anyone else's followers (&lt;em&gt;cough-competitors-cough&lt;/em&gt;).&lt;/p&gt;

&lt;p&gt;The reason being, it's an awesome way to get contact information like emails and phone numbers from a targeted audience. &lt;/p&gt;

&lt;p&gt;In this guide I'll share how you can scrape follower data yourself or completely outsource the scraping. &lt;/p&gt;

&lt;h2&gt;
  
  
  What Kind of Data You Can Scrape From Instagram?
&lt;/h2&gt;

&lt;p&gt;First things first, other than email addresses and phone numbers what other data you can extract from one Instagram account?&lt;/p&gt;

&lt;p&gt;• Instagram Bio&lt;br&gt;
• Number of Followers&lt;br&gt;
• Location (10% of all users have country/city/street)&lt;br&gt;
• Instagram Username&lt;br&gt;
• Instagram Category (1 out of 1500)&lt;br&gt;
• Number of Posts &lt;br&gt;
• Whether it's a business or a regular Instagram account&lt;/p&gt;

&lt;p&gt;All of these data points will help you further analyze your database. For example if you want to find influencers among your followers (or competitors) you can simply sort your dataset by number of followers. That way you'll instantly see which Instagram users are popular and can be used to spread the word about your brand. &lt;/p&gt;
&lt;h2&gt;
  
  
  How to find emails and phone numbers from Instagram followers
&lt;/h2&gt;

&lt;p&gt;Few people know this but 30-40% of all Instagram users have their contact information right on their profile. &lt;/p&gt;

&lt;p&gt;Some of them add it willingly and some not...let me explain. &lt;/p&gt;

&lt;p&gt;There are two ways to find an email address or phone number on Instagram:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Instagram Biography&lt;br&gt;
10% of all users intentionally add their contact details in their bio. Businesses, influencers and even regular users hope someone will reach out to them when they leave their email and contact number in bio. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Instagram Business Accounts&lt;br&gt;
Another 30% of all Instagram users have a so-called Instagram business account. With this type of profile they access additional statistics about their followers such as engagement %. &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;However, what they (probably) don't know is that when creating a business account they also agree to make their personal contact information publicly available. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8194lqknm9qocvzuwa28.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8194lqknm9qocvzuwa28.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  How to Instantly Get Data From Instagram Followers?
&lt;/h2&gt;

&lt;p&gt;There are a lot of data providers that collect Instagram user data and can scrape anyone's Instagram followers instantly. &lt;/p&gt;

&lt;p&gt;Before I continue explaining how you can do this yourself I want to explain why is sometimes better to simply outsource the scraping. &lt;/p&gt;

&lt;p&gt;I use this &lt;a href="https://influencers.club/?utm_source=dev.to&amp;amp;utm_medium=scrape-insta-followers"&gt;Instagram email scraper&lt;/a&gt; because all of their data is validated upon scraping and they offer advanced targeting options like gender, age, location, interest. &lt;/p&gt;

&lt;p&gt;Here's why that's important:&lt;/p&gt;
&lt;h3&gt;
  
  
  Why you need additional targeting?
&lt;/h3&gt;

&lt;p&gt;Although scraping Instagram followers is pretty targeted you still end up with a lot of people that are not relevant to your business. &lt;/p&gt;

&lt;p&gt;• 10% or 90 million Instagram profiles are fake accounts&lt;br&gt;
• A lot of people will simply don't fall in your ideal niche (no gender, location, age or other types of targeting)&lt;/p&gt;

&lt;p&gt;And if you plan on scraping emails for cold email marketing then this will negatively affect your campaigns i.e. very high bounce rates.&lt;/p&gt;
&lt;h3&gt;
  
  
  Why you must clean the scraped data?
&lt;/h3&gt;

&lt;p&gt;Web-scraping means a lot of trash in your net. Some examples would be:&lt;/p&gt;

&lt;p&gt;• Spam-traps&lt;br&gt;
• Catch all emails&lt;br&gt;
• Fake emails&lt;/p&gt;

&lt;p&gt;Here's how this affects your plans:&lt;/p&gt;

&lt;p&gt;Scraped email lists from Instagram can be used in two ways - either for cold emailing or using them as custom audiences in Facebook Ads. &lt;/p&gt;

&lt;p&gt;When you create your cold email campaign and reach out to so many invalid emails, there's a good chance your company domain will end up in SPAM. This means that even regular emails will be considered spam and not reach the desired destination. &lt;/p&gt;

&lt;p&gt;Or, if you import the list as Custom Audiences, Facebook will notice that a lot of your contacts are invalid which may result in permanent ban. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;That's why the &lt;a href="https://influencers.club/2020/10/08/instagram-scraper/?utm_source=dev.to&amp;amp;utm_medium=scrape-insta-followers"&gt;Instagram scraper&lt;/a&gt; I use also validates the emails and offers additional targeting like gender, age, location or emails based on keywords in user bio.&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8qgtlne3bg1l40v9dj89.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8qgtlne3bg1l40v9dj89.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  How to Scrape Instagram Follower Data For Free?
&lt;/h2&gt;

&lt;p&gt;If you have less than 1000 followers you can extract data manually. Note that to see more information on a profile you need to visit all users with the Instagram application i.e. from a mobile device. &lt;/p&gt;

&lt;p&gt;Collect the data by copy-pasting it in a spreadsheet.&lt;/p&gt;

&lt;p&gt;PS. I really don't recommend visiting more than 1k profiles manually (at least not with your personal profile) because you will get your account suspended.&lt;/p&gt;
&lt;h2&gt;
  
  
  Building an Instagram Follower Scraper with Python and GitHub
&lt;/h2&gt;

&lt;p&gt;Python is the best way to scrape anything really. &lt;/p&gt;

&lt;p&gt;Extracting data from Instagram followers with Python comes down to two simple things. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;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)&lt;/li&gt;
&lt;li&gt;Scraping additional details (email, category, etc) for all usernames/ids collected&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;
  
  
  Extract Instagram Followers (User IDs) List
&lt;/h3&gt;

&lt;p&gt;If you only want to scrape follower usernames, here's a code sample by &lt;a class="mentioned-user" href="https://dev.to/tonoli"&gt;@tonoli&lt;/a&gt; (Github).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;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)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is enough to extract the followers of specific Instagram account. &lt;/p&gt;

&lt;p&gt;One thing worth mentioning is that profiles with huge follower base will be harder to scrape with this method (Instagram is pretty strict with call-limits). But for a small account, it should do the job. &lt;/p&gt;

&lt;p&gt;Here's all you'll need to execute this:&lt;br&gt;
• Python 3&lt;br&gt;
• PIP&lt;br&gt;
• Chrome installed (Selenium uses the chromedriver contained in the drivers folder)&lt;br&gt;
• and, Instagram credentials to log in&lt;/p&gt;
&lt;h3&gt;
  
  
  Scraping additional follower details (email, category, etc)
&lt;/h3&gt;

&lt;p&gt;If you only needed to scrape 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.&lt;/p&gt;

&lt;p&gt;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:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;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(
        '&amp;lt;script type="text\/javascript"&amp;gt;([^{]+?({.*profile_pic_url.*})[^}]+?)&amp;lt;\/script&amp;gt;', 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 ....
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Full code available &lt;a href="https://github.com/tonoli/instagram-followers-scraper/blob/master/main.py" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you don’t want to bother with that, you can just upload the list of usernames you already got to &lt;a href="https://api.influencers.club/?utm_source=dev.to&amp;amp;utm_medium=scrape-instagram-followers"&gt;this API&lt;/a&gt; and enrich it with the email addresses. It’s free to sign up and you’ll also get 1500 credits so use it to speed up the process. &lt;/p&gt;

&lt;h2&gt;
  
  
  Get Instagram follower data (no-code)
&lt;/h2&gt;

&lt;p&gt;If you have no previous experience with Python but want to export a list of your followers (without contact data) you can use IGExport. If you are targeting less than 500 followers you can export the list for free. The max amount of followers you can download is 50k. &lt;/p&gt;

&lt;p&gt;And for those of you who also want to get valid &amp;amp; targeted emails and phone numbers from anyone's followers, visit Influencers Club. &lt;/p&gt;

</description>
      <category>python</category>
      <category>php</category>
      <category>github</category>
    </item>
    <item>
      <title>Instagram Scraping | The Top 2021 Guide [Updated]</title>
      <dc:creator>Braydon Buckner</dc:creator>
      <pubDate>Wed, 03 Mar 2021 11:43:34 +0000</pubDate>
      <link>https://dev.to/braydon_buckner_f0e01f8673a/instagram-scraping-the-top-2021-guide-updated-270k</link>
      <guid>https://dev.to/braydon_buckner_f0e01f8673a/instagram-scraping-the-top-2021-guide-updated-270k</guid>
      <description>&lt;p&gt;In this guide, you will find the best ways to scrape Instagram data. You can extract Instagram emails, phone numbers, images/photos, user bio, hashtags, etc. &lt;/p&gt;

&lt;p&gt;To get the data you can scrape based on the followers of a specific Instagram account (your own or your competitors) or relevant hashtags. &lt;/p&gt;

&lt;p&gt;Sit tight. &lt;/p&gt;

&lt;h2&gt;
  
  
  Instagram Scraper Tool - How to Build One Yourself
&lt;/h2&gt;

&lt;p&gt;As you’ll see in this article, it’s money and time consuming to develop an Instagram scraper yourself so if you want to skip the whole process and get targeted and validated data use this &lt;a href="https://influencers.club/?utm_source=dev.to/instagram-scraper"&gt;Instagram email scraper&lt;/a&gt;. &lt;/p&gt;

&lt;h3&gt;
  
  
  Scraping Instagram data with the unofficial API
&lt;/h3&gt;

&lt;p&gt;To access the unofficial Instagram API you need to use the mobile app since we’re after the mobile endpoints. If we intercept the traffic coming from Instagram’s servers and to we’ll be able to collect Instagram data. &lt;/p&gt;

&lt;p&gt;Read more about how to access the API and scrape data from Instagram visit this &lt;a href="https://influencers.club/2020/10/08/instagram-scraper/"&gt;Instagram scraper tool&lt;/a&gt;. &lt;/p&gt;

&lt;h3&gt;
  
  
  Instagram scraping with Python and GitHub
&lt;/h3&gt;

&lt;p&gt;The above-mentioned mobile endpoints can be accessed with Python, PHP, or any other language that can log into Instagram profiles and extract data. While it’s only a couple of Python lines, there is so much more to it but here it goes. &lt;/p&gt;

&lt;p&gt;To log into a profile and use the unofficial Instagram API use the code sample from this &lt;a href="https://github.com/sokolmkd/Instagram-API-python"&gt;GitHub&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def login(self, force=False):
        """
            Authenticate this API instance.
            If already logged in (and not later logged out) does nothing (unless forced).
        :param force: if true, will attempt to log in even if already logged in.
        :return: dictionary of responses.
        """
        if not self._isloggedin or force:
            self._session = requests.Session()
            # if you need proxy make somethin://proxyip:proxyport"}
            full_response = self._sendrequest(
                'si/fetch_headers/?challenge_type=signup&amp;amp;amp;guid=' + self.generate_uuid(False), login=True)
            data = {
                'phone_id': self.generate_uuid(True),
                '_csrftoken': full_response.cookies['csrftoken'],
                'username': self._username,
                'guid': self._uuid,
                'device_id': self._deviceid,
                'password': self._password,
                'login_attempt_count': '0'}
            try:
                full_response = self._sendrequest(
                    'accounts/login/',
                    post=self._generatesignature(json.dumps(data)),
                    login=True)
            except InstagramAPIBase._2FA_Required as exception:
                # In order to login, need to provide the second factor (i.e. SMS code or backup code).
                # Use call-back to get this string.
                if not self._two_factor_callback:
                    raise AuthenticationError("This account requires support for Two-Factor Authentication")
                two_factor_info = exception.two_factor_info = exception.two_factor_info
                verification_string = self._two_factor_callback(two_factor_info)
                data = {
                    'verification_code': verification_string,
                    'two_factor_identifier': g like this:
            # self.s.proxies = {"https": "httptwo_factor_info['two_factor_identifier'],
                    '_csrftoken': full_response.cookies['csrftoken'],
                    'username': self._username,
                    'device_id': self._deviceid,
                    'password': self._password,
                }
                full_response = self._sendrequest(
                    'accounts/two_factor_login/',
                    post=self._generatesignature(json.dumps(data)),
                    login=True)
            self._isloggedin = True
            decoded_text = json.loads(full_response.text)
            self._loggedinuserid = decoded_text["logged_in_user"]["pk"]
            self._ranktoken = "%s_%s" % (self._loggedinuserid, self._uuid)
            self._csrftoken = full_response.cookies["csrftoken"]
            return decoded_text
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From my experience, logging in is pretty straightforward. Use a proxy (if possible from the location you’re at) and fill out any captchas necessary. After the accounts rest for a few days you can start your scraping. &lt;/p&gt;

&lt;p&gt;P.s. be extremely cautious with the login request because it can trigger Instagram’s algorithm to keep an eye on you.&lt;/p&gt;

&lt;h3&gt;
  
  
  Instagram scraping profiles for getting the data
&lt;/h3&gt;

&lt;p&gt;While I started manually collecting emails and phone numbers from Instagram I now own 1500 Instagram profiles that simultaneously crawl the platform. And it’s not too much! You need a large number of accounts because the API call limit is very...limited. Meaning you can only gather so much data from one account. &lt;/p&gt;

&lt;p&gt;So, if you’re serious about building an Instagram tool online with Python you have to remember two things:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Never use your personal Instagram account&lt;/li&gt;
&lt;li&gt;And the Instagram profiles you purchase need to be aged and validated with a phone number (if you don’t want to get suspended)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Another thing to remember is that Instagram has gotten pretty smart in detecting fake accounts that are purchased at scale. Mainly they study the gray market and track the source. &lt;/p&gt;

&lt;p&gt;My suggestion is to diversify and buy accounts from multiple sources and see which one is safe. &lt;/p&gt;

&lt;h3&gt;
  
  
  To keep the Instagram scraping safe use proxies
&lt;/h3&gt;

&lt;p&gt;When you use proxies, Instagram no longer tracks your IP address but the address of the proxy used. While you can scrape from one server, you still need to make sure to keep the IP simulations low because logging in from more than 5 different IG accounts can be a huge problem. &lt;/p&gt;

&lt;p&gt;Just as I previously mentioned the problem of the gray market and Instagram, the same holds true for proxies as well. &lt;/p&gt;

&lt;p&gt;Instagram has the ability to detect millions of proxy providers, and you need to find the perfect one for long-term scraping. &lt;/p&gt;

&lt;h2&gt;
  
  
  Benefits and drawbacks of having your own Instagram scraper
&lt;/h2&gt;

&lt;p&gt;It’s pretty hard creating your own tool that can extract Instagram user data, so let’s see whether building your own tool is viable or not. &lt;/p&gt;

&lt;p&gt;Starting with the pros&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Having full control over the whole process&lt;/li&gt;
&lt;li&gt;You can use and reuse the email addresses and phone numbers&lt;/li&gt;
&lt;li&gt;And sell and resell the database&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;And the drawbacks of an in-house scraper are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;No segmentation or additional targeting &lt;/li&gt;
&lt;li&gt;A lot of bot accounts scraped&lt;/li&gt;
&lt;li&gt;With it comes tons of invalid emails, spam traps, catch-alls &lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Skip the whole process and get an Instagram email list instantly?
&lt;/h3&gt;

&lt;p&gt;There are data scraping companies that have been crawling Instagram for years. They’ve become so advanced that now they offer additional targeting options that you otherwise wouldn’t get. &lt;/p&gt;

&lt;p&gt;Some of them are &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Gender&lt;/li&gt;
&lt;li&gt;Interest&lt;/li&gt;
&lt;li&gt;Country/city&lt;/li&gt;
&lt;li&gt;Age&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are advanced targeting options that you can’t get from scraping your competitors’ followers or a hashtag relevant to your brand. But they are crucial in a marketing campaign. &lt;/p&gt;

&lt;p&gt;One provider that’s separating from the bunch is Influencers Club that offers all of these options + the data you get is validated i.e. safe to use. You can check out their &lt;a href="https://influencers.club/pricing/"&gt;pricing&lt;/a&gt; here. &lt;/p&gt;

&lt;h2&gt;
  
  
  Codes for Instagram email scraping (Python)
&lt;/h2&gt;

&lt;p&gt;All code samples are from this &lt;a href="https://github.com/sokolmkd/Instagram-API-python"&gt;GitHub repository&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;After you’re logged in with an Instagram scraping account from a safe proxy you can start scraping emails. &lt;/p&gt;

&lt;p&gt;The only mobile endpoints (API) you need are the ones below and the one for email addresses is&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/api/v1/users/{{user_id}}/info/


User.public_email
Email address

user.username
The Username

user.is_private
If this is a private account

user.full_name
User’s full name

user.profile_pic_url
User’s profile photo URL

user.biography
User’s bio

user.external_url
User’s website

user.follower_count
Follower count

user.following_count
Following count

user.media_count
Number of posts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The table shows the data points you can get with this code.&lt;/p&gt;

&lt;h2&gt;
  
  
  Create Instagram Phone Number Scraper Tool
&lt;/h2&gt;

&lt;p&gt;Scraping phone numbers from Instagram uses the same API call as the one for email addresses. Of course, you can only find an Instagram phone number if the user has agreed to share it publicly.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/api/v1/users/{{user_id}}/info/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;According to my stats, only 10-15% of all Instagram users have their personal number publicly available which is close to 200 million users.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts on Instagram Scraping
&lt;/h2&gt;

&lt;p&gt;In very few cases it’s actually ROI positive to build an Instagram scraping tool. It takes a lot of time and money to gather data, just to find out that the data is not really actionable. &lt;/p&gt;

&lt;p&gt;I’m saying that because having Instagram data like email addresses will definitely ruin your cold email campaign because of high bounce rate. &lt;/p&gt;

&lt;p&gt;Or if you plan on using the list in Facebook ads as &lt;a href="https://www.facebook.com/business/help/744354708981227"&gt;custom audiences&lt;/a&gt; you can trigger their algorithm as you import a lot of invalid emails. &lt;/p&gt;

&lt;p&gt;So maybe most of you should just visit one of these Instagram scraping companies that will make all of this safe and instant. &lt;/p&gt;

&lt;p&gt;I recommend you check out  Influencers Club. &lt;/p&gt;

</description>
      <category>python</category>
      <category>php</category>
      <category>github</category>
    </item>
    <item>
      <title>How To Build Your Own Instagram Email Scraper </title>
      <dc:creator>Braydon Buckner</dc:creator>
      <pubDate>Tue, 02 Feb 2021 07:09:23 +0000</pubDate>
      <link>https://dev.to/braydon_buckner_f0e01f8673a/how-to-build-your-own-instagram-email-scraper-4o7j</link>
      <guid>https://dev.to/braydon_buckner_f0e01f8673a/how-to-build-your-own-instagram-email-scraper-4o7j</guid>
      <description>&lt;p&gt;&lt;strong&gt;Important note&lt;/strong&gt;: Please be advised that automatically scraping emails from Instagram is against their terms of service.&lt;/p&gt;

&lt;p&gt;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, &lt;a href="https://influencers.club/?utm_source=dev.to&amp;amp;utm_medium=instagram-email-scraper"&gt;get in touch with Influencers Club&lt;/a&gt; and just buy email addresses from Instagram.&lt;/p&gt;

&lt;p&gt;Here's how you can build your own Instagram email scraper and get a lot of other data points like phone numbers, bio text, images, and more. &lt;/p&gt;

&lt;h2&gt;
  
  
  1. Access the unofficial Instagram API
&lt;/h2&gt;

&lt;p&gt;To access the unofficial Instagram API you need to use mobile endpoints with Python or PHP. &lt;/p&gt;

&lt;p&gt;You can take the code sample from this &lt;a href="https://github.com/sokolmkd/Instagram-API-python"&gt;Github public repos&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;def login(self, force=False):&lt;br&gt;
        """&lt;br&gt;
            Authenticate this API instance.&lt;br&gt;
            If already logged in (and not later logged out) does nothing (unless forced).&lt;br&gt;
        :param force: if true, will attempt to log in even if already logged in.&lt;br&gt;
        :return: dictionary of responses.&lt;br&gt;
        """&lt;br&gt;
        if not self._isloggedin or force:&lt;br&gt;
            self._session = requests.Session()&lt;br&gt;
            # if you need proxy make somethin://proxyip:proxyport"}&lt;br&gt;
            full_response = self._sendrequest(&lt;br&gt;
                'si/fetch_headers/?challenge_type=signup&amp;amp;guid=' + self.generate_uuid(False), login=True)&lt;br&gt;
            data = {&lt;br&gt;
                'phone_id': self.generate_uuid(True),&lt;br&gt;
                '_csrftoken': full_response.cookies['csrftoken'],&lt;br&gt;
                'username': self._username,&lt;br&gt;
                'guid': self._uuid,&lt;br&gt;
                'device_id': self._deviceid,&lt;br&gt;
                'password': self._password,&lt;br&gt;
                'login_attempt_count': '0'}&lt;br&gt;
            try:&lt;br&gt;
                full_response = self._sendrequest(&lt;br&gt;
                    'accounts/login/',&lt;br&gt;
                    post=self._generatesignature(json.dumps(data)),&lt;br&gt;
                    login=True)&lt;br&gt;
            except InstagramAPIBase._2FA_Required as exception:&lt;br&gt;
                # In order to login, need to provide the second factor (i.e. SMS code or backup code).&lt;br&gt;
                # Use call-back to get this string.&lt;br&gt;
                if not self._two_factor_callback:&lt;br&gt;
                    raise AuthenticationError("This account requires support for Two-Factor Authentication")&lt;br&gt;
                two_factor_info = exception.two_factor_info = exception.two_factor_info&lt;br&gt;
                verification_string = self._two_factor_callback(two_factor_info)&lt;br&gt;
                data = {&lt;br&gt;
                    'verification_code': verification_string,&lt;br&gt;
                    'two_factor_identifier': g like this:&lt;br&gt;
            # self.s.proxies = {"https": "httptwo_factor_info['two_factor_identifier'],&lt;br&gt;
                    '_csrftoken': full_response.cookies['csrftoken'],&lt;br&gt;
                    'username': self._username,&lt;br&gt;
                    'device_id': self._deviceid,&lt;br&gt;
                    'password': self._password,&lt;br&gt;
                }&lt;br&gt;
                full_response = self._sendrequest(&lt;br&gt;
                    'accounts/two_factor_login/',&lt;br&gt;
                    post=self._generatesignature(json.dumps(data)),&lt;br&gt;
                    login=True)&lt;br&gt;
            self._isloggedin = True&lt;br&gt;
            decoded_text = json.loads(full_response.text)&lt;br&gt;
            self._loggedinuserid = decoded_text["logged_in_user"]["pk"]&lt;br&gt;
            self._ranktoken = "%s_%s" % (self._loggedinuserid, self._uuid)&lt;br&gt;
            self._csrftoken = full_response.cookies["csrftoken"]&lt;br&gt;
            return decoded_text&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Use a proxy from the location you're already at and make sure to complete any captchas if necessary. Then let the profile rest for couple of days before the scraping because Zucker is now watching you. &lt;/p&gt;

&lt;h2&gt;
  
  
  2. Get a lot of Instagram profiles
&lt;/h2&gt;

&lt;p&gt;Two main things to remember here - is to always use aged Instagram profiles that are phone-validated otherwise they'll get banned immediately. &lt;/p&gt;

&lt;p&gt;The second thing is to never use your personal profiles. &lt;/p&gt;

&lt;p&gt;You can buy Instagram accounts from Facebook groups, DM's on Instagram or online stores. &lt;/p&gt;

&lt;h2&gt;
  
  
  3. Proxies
&lt;/h2&gt;

&lt;p&gt;Don't stimulate too many IPs because logging in more than 5 accounts on the same IP a huge no-no. &lt;/p&gt;

&lt;p&gt;Same as with Instagram accounts, the issue occurs with proxies. Zucker can detect proxy providers and before you find a good one you're in deep trouble. &lt;/p&gt;

&lt;p&gt;To check whether the provider is not on the radar &lt;a href="https://www.whoismyisp.org/"&gt;use this website&lt;/a&gt; and simply paste your proxies IP. &lt;/p&gt;

&lt;h2&gt;
  
  
  Building an Instagram email scraper
&lt;/h2&gt;

&lt;p&gt;Here's a &lt;a href="https://github.com/sokolmkd/Instagram-API-python"&gt;Github Repo&lt;/a&gt; for all the code samples you need for creating your own &lt;a href="https://influencers.club/2020/10/08/instagram-scraper/?utm_source=dev.to&amp;amp;utm_medium=instagram-email-scraper"&gt;Instagram scraper&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;Once you're logged with an IG profile from a proxy, getting the data is "easy enough". &lt;/p&gt;

&lt;p&gt;You only need the API endpoints. &lt;/p&gt;

&lt;p&gt;And the one for getting emails is:&lt;br&gt;
&lt;code&gt;/api/v1/users/{{user_id}}/info/&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;User.public_email    Email address&lt;br&gt;
user.username   The Username&lt;br&gt;
user.is_private If this is a private account&lt;br&gt;
user.full_name  User’s full name&lt;br&gt;
user.profile_pic_url    User’s profile photo URL&lt;br&gt;
user.biography  User’s bio&lt;br&gt;
user.external_url   User’s website&lt;br&gt;
user.follower_count Follower count&lt;br&gt;
user.following_count    Following count&lt;br&gt;
user.media_count    Number of posts&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;For more information check Influencers Club. &lt;/p&gt;

</description>
      <category>database</category>
      <category>startup</category>
      <category>python</category>
      <category>php</category>
    </item>
  </channel>
</rss>
