Python: Scrape Competitor Instagram Accounts

Use Python to scrape your competitors' Instagram accounts and gain insights into their strategies and followers.

Python: Scrape Competitor Instagram Accounts
Level :
3/3
Duration : 
2/3
non définie
Free
Gratuit

Marketers are increasingly using Python to collect data on social networks.

In this complete tutorial, we'll see how to use the powerful OSINT bookstore for Instagram “Osintgram” to scrape valuable information on the Instagram accounts of your competitors or your target audience.

framework OSINT

On the agenda: automatically retrieve thousands of follower emails, analyze hashtag trends, identify key influencers, and much more! Enough to boost your commercial prospecting and your social media intelligence.

So, ready to go through the mirror and become an OSINT pro on Instagram? Let's go for an exceptional Growth Hack! 🚀

Prerequisites

Before we start, let's make sure you have all the necessary elements:

  • A computer with Python 3.7+ installed (Mac, Windows, Linux, whatever)
  • Good command line concepts (or know how to copy and paste these into your terminal)
  • A dedicated Instagram account for your tests (especially not your personal account!)
  • Ideally a disposable phone number to create this test account

Indeed, even if scraping public data on Instagram is not illegal in itself, it is still contrary to their terms and conditions. So to avoid any risk of your precious personal account being banned, we will use a trash account created for the occasion.

Step-by-Step Detailed Guide

1. Installing Osintgram

Osintgram is an open-source library available on Github.

To install it, nothing could be easier:

  1. Open your terminal
  2. Type git clone https://github.com/Datalux/Osintgram.git To close the deposit
  3. Place yourself in the folder with Cd Osintgram
  4. Install dependencies by running pip3 install -r requirements.txt
  5. Go to the configuration folder with CD config
  6. Edit the credentials.ini configuration file by entering the command vi credentials.ini then save
fichier de configuration osintgram

And that's it, Osintgram is ready to use on your machine! You can check that everything is working by launching Python3 main.py -h to show help.

compte Osintgram piratage Instagram

Note that there is also an excellent tutorial video on the InformationSecurityTube Youtube channel that guides you step by step through the installation and getting started, I am putting the link for you as a reference.

2. Create an Anonymous Instagram Account with Dingtone

Créez un Compte Instagram Anonyme avec Dingtone

To conduct your investigations calmly, it is better to use an Instagram account separate from your personal profile. And for more security, we will even associate it with a virtual phone number using the Dingtone application.

Here's how to do it:

  1. Download the Dingtone app on your Android or iOS smartphone
  2. Open the app and enter your real number to create an account
  3. Claim your “Welcome Credit” in the “Earn Free Credits” tab
  4. Click on “Second Phone Number” to choose a new number
  5. Select a number from the list (check that it is “permanent”)
  6. Validate and you are now with a second line ready to use!

Now, simply create your new Instagram profile using this virtual number during registration. So you can use it for all your social listening activities without compromising your main account.

A little tip: to make this account even more realistic, add a real profile photo and a few posts before you start scraping. With that, you should go completely unnoticed!

3. Collecting account data

Now that Osintgram is in place, it's time to get valuable information on an Instagram account!

The command to scrape a public profile is very simple:

Python3 main.py USERNAME

Simply replace USERNAME with the name of the account you want to investigate, for example a competitor or an influencer in your niche. Then let the magic happen!

You will see all the public information of the scanned profile scroll through your terminal:

  • Full name
  • Bio
  • Number of followers
  • Number of followings
  • Number of posts
  • If the account is verified
  • Account creation date
  • Etc.

Then, you will find all this information neatly organized in a text file automatically generated in the Osintgram directory.

But that's just the tip of the iceberg!

Osintgram can go much, much further in collecting data... Let's see that right away.

4. Osintgram Advanced Commands

Growth Hack compte Instagram Python

The power of Osintgram lies in its numerous commands that allow you to retrieve very precise data and export it easily. Here are some of them that are particularly useful:

  • python3 main.py USERNAME -f : Get the list of followers of the account
  • Python3 main.py USERNAME -fg : Get the list of account followings
  • Python3 main.py USERNAME -fh : Get the list of hashtags used by the account
  • Python3 main.py USERNAME -ft : Get a list of all tags/mentions in the account

You can also combine multiple commands for further investigation. For example, to retrieve the last 100 followers with their respective number of posts and followers:

python3 main.py USERNAME -f -n 100 --pgeo --fwr

Or to get a list of followers' email addresses:

python3 main.py USERNAME -f --email

It is very practical to quickly build a base of qualified prospects to whom you can send your offers! You can retrieve thousands of emails in no time.

5. Some use cases

cas d'usage

As we have seen, Osintgram makes it possible to collect a goldmine of information on any public Insta account. Here are a few ideas for making smart use of this data:

  • Analyze the hashtags and mentions of influential accounts in your sector to identify trends and be inspired by them in your content
  • Scrape the emails of your competitors' followers to send them your best offers
  • Identify the most active/engaged followers to become ambassadors
  • Keep an eye on new posts from key accounts to stay on top

In short, these are only a few examples but the possibilities are endless. It's up to you to be creative to get the most out of this powerful tool!

Osintgram limitations

Obviously, like any borderline growth hack, there are a few precautions and limitations to keep in mind with Osintgram:

  • Unable to retrieve data from private or non-existing accounts
  • Too many requests at once can trigger Instagram bot security
  • Misuse of Osintgram may lead to your account being banned
  • Respect for privacy and RGPD remain the order of the day

So we avoid spamming requests every second and we space out the launches a bit. In any case it is in your best interest not to be detected. A good practice is to use a proxy to get through the cracks.

And of course, we use this data in an ethical and responsible way. The aim is to get an idea of trends and build up lists of relevant prospects, not to harass users. Good growth is ethical growth!

Other Option: Retrieve Targeted Profiles with Phantombuster

Récupérez des Profils Ciblés avec Phantombuster

In addition to Osintgram, which retrieves public account data, you can also use a tool like Phantombuster to directly suck up lists of followers or posts. It is a perfect complement to your research!

The process is simple:

  1. Create an account on Phantombuster and add credits
  2. Connect your Instagram account (preferably the one created with Dingtone)
  3. Choose the phantom “Instagram Follower Collector” or “Instagram Posts Collector”
  4. Enter the URL of the profile you want to scrape
  5. Set the number of results you want
  6. Start the phantom and wait a few minutes
  7. Get your CSV or JSON file with all the profiles/posts collected!

You can thus easily build hyper-targeted lists of followers to contact, or analyze the best publications of your competitors. Enough to feed your influence campaigns or your strategic intelligence!

FULL TUTORIAL: Collect the Instagram followers of your competitors

Conclusion

I hope this tutorial gave you a good overview of the immense potential of Osintgram to boost your presence on Instagram. It really is an incredible tool for any self-respecting Growth Hacker.

With a bit of creativity and an intelligent use of advanced controls, you will be able to take your prospecting and content marketing to the next level. Imagine all the trails that you will be able to explore thanks to the information collected!

So go ahead and test for yourself and get familiar with all the options. But always keep in mind the limits mentioned to stay on track.

And above all, remember to lock the security of your account with a disposable number to test with confidence. You can never be too careful!

With that, it's up to you to play now. Become an OSINT pro with Osintgram and give a real head start to your social media strategies. The results will be felt quickly, believe me!

upvote triangle
53
Merci !
Was this tip helpful to you? Vote in one click above.
photo stephen mesnildrey
Stephen MESNILDREY
Digital & MarTech Innovator

Your time is valuable... imagine:

Doubling your productivity in 30 days...Cutting operational costs by 40%...Increasing your ROI by 25% in 6 months...

Sounds too good to be true? Yet:

  • ✅ 71,000+ executives have seen their growth soar by 35% on average
  • ✅ 5 years guiding startups to success (valued at $20M+)
  • ✅ 100,000+ professionals draw inspiration from my articles every month

Want to stay ahead of the curve? You're in the right place! 💡

📩 Subscribe to my newsletter and receive weekly:

  • 👉 1 high-impact, ready-to-use strategy
  • 👉 2 in-depth analyses of transformative SaaS tools
  • 👉 3 practical AI applications for your industry

The journey starts now... and it's going to be extraordinary! 🚀

Join Me on Social Media for Exclusive Tips and Updates