[GUIDE] How to differentiate Organic Likes from Total

Hi Guys,

Please find a short guide of how to find out which Likes has been Organic and which came from boosting the post together with necessary files [will be send to you upon request, I can’t upload them in zipped format] to make it work.

Step 1. Install Python on your computer and make sure it’s working correctly.

Step 2. DM me for files [I will email them to you] or use this link: https://drive.google.com/folderview?id=1eBDuhzVbpe3h4HP_AKfjOpHt4O1lU_WA

Step 3. Unzipped the files and save them in one folder [It should look like this]

image

Step 4. On Windows, place your mouse cursor inside the folder with the files and press Ctrl + Shift + Right Mouse Button and open Windows PowerShell. It should look like this:

Step 5. type "python app.py +link to the account that you would like to check, press Enter

You should get something like this:

Step 6. Open result.txt from the Instagram Scraper folder. It should be populated with a data already

image

Step 7. Go to https://jsonlint.com/ and copy/paste the data from the result.txt. Press Validate JSON

Step 8. You should be able to see Total Likes and Organic Likes

The below part is for those who are interested where is this data actually coming from and how we know what’s what in Python.

  1. There is much more information possible to extract, but I kept only what we were interested in. We used this guide kindly shared by @ido https://edmundmartin.com/scraping-instagram-with-python/

  2. After testing it with one account, I think that value responsible for Organic Likes is “edge_liked_by” and “edge_media_preview_like” must be number of Total Likes including Sponsored.

  3. Code below:

from random import choice
import json

import requests
from bs4 import BeautifulSoup

_user_agents = [
‘Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36’
]

class InstagramScraper:

def __init__(self, user_agents=None, proxy=None):
    self.user_agents = user_agents
    self.proxy = proxy

def __random_agent(self):
    if self.user_agents and isinstance(self.user_agents, list):
        return choice(self.user_agents)
    return choice(_user_agents)

def __request_url(self, url):
    try:
        response = requests.get(url, headers={'User-Agent': self.__random_agent()}, proxies={'http': self.proxy,
                                                                                             'https': self.proxy})
        response.raise_for_status()
    except requests.HTTPError:
        raise requests.HTTPError('Received non 200 status code from Instagram')
    except requests.RequestException:
        raise requests.RequestException
    else:
        return response.text

@staticmethod
def extract_json_data(html):
    soup = BeautifulSoup(html, 'html.parser')
    body = soup.find('body')
    script_tag = body.find('script')
    raw_string = script_tag.text.strip().replace('window._sharedData =', '').replace(';', '')
    return json.loads(raw_string)

def profile_page_metrics(self, profile_url):
    results = {}
    try:
        response = self.__request_url(profile_url)
        json_data = self.extract_json_data(response)
        metrics = json_data['entry_data']['ProfilePage'][0]['graphql']['user']
    except Exception as e:
        raise e
    else:
        for key, value in metrics.items():
            if key != 'edge_owner_to_timeline_media':
                if value and isinstance(value, dict):
                    value = value['count']
                    results[key] = value
                elif value:
                    results[key] = value
    return results

def profile_page_recent_posts(self, profile_url):
    results = []
    try:
        response = self.__request_url(profile_url)
        json_data = self.extract_json_data(response)
        metrics = json_data
        #return metrics
        metrics = json_data['entry_data']['ProfilePage'][0]['graphql']['user']['edge_owner_to_timeline_media']["edges"]
    except Exception as e:
        raise e
    else:
        for node in metrics:
    
            node = node.get('node')
            obj = dict()
            obj['organic_likes'] = node['edge_liked_by']
            obj['total_likes'] = node['edge_media_preview_like']
            obj['url'] = node['display_url']
            if node and isinstance(node, dict):
                results.append(obj)
    return results

Ps. Please let me know if you have more experience in this or spot a mistake so I can fix it.

Ps2. Is it possible to upload zipped files and attach them to this post so everyone can download them directly?

A big credit goes to @ido for pointing me in the right direction :+1:

Thanks :slight_smile:

23 Likes

Booya, good stuff! Thanks for sharing <3

1 Like

Btw. The files I got don’t require you to code or anything. The code at the bottom of the post is for illustrative purpose and for those who would like to take it a step further and add other options.

1 Like

Edge_liked_by is the regular like count you see in the app or when you are on the post Page on web.
edge_media_preview_likes is the amount you see in the lightbox when you hover over an image on web. :slight_smile:

3 Likes

Could you not simply put it on google drive or dropbox and share? Might be easier

So do you know why are these values different for boosted posts?

Edge_like_by was at around 500 and the other was 4500 and this was a value of total likes received by the post

Do you know which value then it would be?

To be honest, I don’t think that the split between paid likes and organic likes will be visible to anyone, apart from the owner of the account (or people managing the ads). Same goes for the page insights :slight_smile: .

I just adapted one of my scrapers to do a quick test on the ratio of edge_liked_by and edge_media_preview_like to test it on multiple accounts (41 to be exact). Big and famous ones, and just regular popular travel accounts (that aren’t verified or have millions of followers).

On my test of 504 posts, both datapoints matched exactly, so there was no difference.

For what it’s worth, here’s the data:

In the past, I do remember seeing a difference between the two, but I do believe it’s more a bug or a temporary glitch. As it mostly didn’t take long for both values to catch up to each other. This doesn’t mean that there’s no difference between the two, but I do think that it isn’t what you expected/wanted it to be.

Regardless, I applaud your effort! Once you dive into the data and start questioning the things you see, you’re making strides towards becoming more knowledgeable about the gram!

8 Likes

Hey, thanks for that.

I still don’t understand why I can see a difference in between those two values on posts that has been boosted while those that hasn’t have equal values.

I will post screenshots tomorrow, maybe there is something that I’m missing in this.

Sounds good :slight_smile: feel free to DM me the post links and I’ll have a look at the same posts :wink:

1 Like

No worries, I will. Thanks!

1 Like

Hey @nocturnae

So I looked at my results and I can see a difference in between those two values on certain posts:

( As a reminder “Organic Likes” are “edge_liked_by” and “Total Likes” are “edge_media_preview_like” in this)

EXAMPLE
{
‘url’: u ‘https://scontent-lhr3-1.cdninstagram.com/vp/7d6b9a3cdf8f750689cd20f585b929fd/5CC3DF30/t51.2885-15/e15/52385039_420842588652700_2203579452364320308_n.jpg?_nc_ht=scontent-lhr3-1.cdninstagram.com’,
‘total_likes’: {
u ‘count’: 3691431
},
‘organic_likes’: {
u ‘count’: 3131381
}

This is the post:

Link to the post:

Do you know what Edge_like_by value is then responsible for? It’s definitely not views or comments from what I can see.

Thanks!

1 Like

Nice work! Thanks for sharing, Glad I could help. :smile:

Regarding the real difference between the two metrics, I’m really not sure as it is all speculations…
But the reality is that I find the two metrics identical on my accounts that does not do post boosting and on those who does there are differences…

I will experiment with it further and try to get some more insights.

1 Like

I have got exactly the same results. Those two values are different on boosted posts so this is where my conclusion is coming from.

The example is from Nike, but all the posts that I am 100% sure that were boosted show different values.

It might be worth to check a Like count before boosting, save the data and then boost a post.

It’s an interesting concept but I am really doubtful IG would be showing this information publicly

I will boost one of the old posts today and see what happens :slight_smile:

2 Likes

Thanks for doing this experience and sharing your results and conclusions with us :slight_smile:

1 Like

thanks @Wsiolek & @nocturnae for sharing!

1 Like

Hi,

So I tested this on one of my posts and it looks like it is actually true :slight_smile:

Method of testing:

  1. I picked an old post that wasn’t getting any traction anymore and boosted it for £10 for 24h

  2. I checked the post likes before the promotion has been approved and it was 253

  3. I run this post through the scraper and it spits out the following result:
    {
    ‘url’: u ‘https://scontent-lhr3-1.cdninstagram.com/vp/cd4f2f8dc6b3b536846bc4879bb39eb8/5D520BB8/t51.2885-15/e35/56611753_163892134614481_5788389621904584550_n.jpg?_nc_ht=scontent-lhr3-1.cdninstagram.com’,
    ‘total_likes’: {
    u ‘count’: 253
    },
    ‘organic_likes’: {
    u ‘count’: 253
    }

You can see that both numbers were equal before the test and show the amount of likes that my post accumulate organically - 253

  1. After the promo started, to be absolutely sure I gave this post 2 organic likes - one from the account that is following tested account and one from the account that doesn’t. The “organic likes” rises to 255 (please see below).

Those 2 likes were given by going directly to the profile, clicking on the post and liking it.

  1. During the promo, I was checking every like received by this post by going to notification tab and checking every single one of them. They all came from sponsored post. (You can easily differentiate between organic and sponsored as if you click on the post it look slightly different).

  2. Run the scraper again after the promo is finished.

  3. The results below:

{
‘url’: u ‘https://scontent-lhr3-1.cdninstagram.com/vp/cd4f2f8dc6b3b536846bc4879bb39eb8/5D520BB8/t51.2885-15/e35/56611753_163892134614481_5788389621904584550_n.jpg?_nc_ht=scontent-lhr3-1.cdninstagram.com’,
‘total_likes’: {
u ‘count’: 284
},
‘organic_likes’: {
u ‘count’: 255
}

As a reminder - Organic likes started at 253 + 2 organic likes from my other accounts.
I personally counted 29 notifications with likes for this post coming during the time of promotion.

So I would say that it works :slight_smile:

Total likes spit out by the scraper is the amount of organic + sponsored (both values will be the same for not sponsored posts).

Hope someone else will find it useful.

Thanks!

2 Likes

Hey, done.

I have updated the main post so it now include Google Drive link.

1 Like

Very interesting. But they are only counting likes from followers as organic, and not ones accumulated from non followers. Hit it with some LE.

1 Like