3

I am trying to pull the number of followers from a list of Instagram accounts.

I want to integrate Instagram API or any hack solution to get out no of followers on the Instagram account.

I found many solutions for the above problem but none of them work properly

the link which I follow: Grab Instagram Follower count Grab Instagram Follower count

Welcome_back
  • 1,245
  • 12
  • 18
  • I tried your first link, and the proposed solution works perfectly to retrieve followers/followed with this url: https://www.instagram.com//?__a=1 – madmax Aug 19 '22 at 07:15
  • @AnotherOne I tried this one not working always, – Welcome_back Aug 19 '22 at 07:59
  • this works fine in postman or any browser, but when I am trying to write script in python getting None in response – Welcome_back Aug 19 '22 at 10:04
  • 1
    This is maybe due to instagram trying to prevent you from accessing this data programmatically. You could try to fool their server by copying the request headers of Postman or your Browser in your code before making a request. – madmax Aug 22 '22 at 07:36

3 Answers3

1

As far as I know, Instagram doesn't have any APIs official or unofficial.

So, I have used the Node.Js and implemented this by following the geeksforgeeks code

Index.js

const express = require('express');
const followers = require('instagram-followers');
const app = express();
    
app.get('/' , (req , res)=>{
    res.send("GeeksforGeeks");
});
    
app.get('/:username' , (req , res) => {
    followers(req.params.username).then((count) => {
        if(!count){
            res.send("Account Not Found");
            return;
        }
        res.send("Username " + req.params.username +
            " have " + "<b>" + count + "</b>" + " followers");

    });
});

// Server setup
app.listen(4000 , ()=>{
    console.log("server is running on port 4000");
});

enter image description here

Sreeram Nair
  • 2,369
  • 12
  • 27
1

you could use a ajax request for getting the count by using this link to get token

  $.ajax({

  url: 'https://api.instagram.com/v1/users/self',

  dataType: 'jsonp',

  type: 'GET',

  data: {access_token: token},

  success: function(data){

      var follows = data['data']['counts']['follows'];

      $(".instagram").text(follows);

  },

  error: function(data){

      console.log(data);

  }

if you need more information you can check the source from where i found it

TeaCup404
  • 11
  • 2
1

Github Link for Instagram Unofficial API Check out the API and follow the steps as I am showing you.

Install the API

pip install git+https://git@github.com/ping/instagram_private_api.git@1.6.0

Code

from instagram_private_api import Client, ClientCompatPatch 
username = 'test' 
password = 'test' 
api = Client(username, password) 
results = api.user_follows('test') 
print([item['pk'] for item in results.get('users', [])])