How to get other pages followers count number in Instagram?

烈酒焚心 提交于 2019-12-04 07:54:21

问题


is there possibility to get other pages follower count number in Instagram? I can get only my profile followers count number, but I want to get other followers too? (for example in php)

Any ideas?


回答1:


Yes, it's possible with ?__a=1 queries which return json.

$otherPage = 'nasa';
$response = file_get_contents("https://www.instagram.com/$otherPage/?__a=1");
if ($response !== false) {
    $data = json_decode($response, true);
    if ($data !== null) {
        $follows = $data['graphql']['user']['edge_follow']['count'];
        $followedBy = $data['graphql']['user']['edge_followed_by']['count'];
        echo $follows . ' and ' . $followedBy;
    }
}



回答2:


Jumping through hoops to get an app approved for quickly checking follower counts seemed excessive so I had a look at network requests on Instagram's web search and saw that typing in the search box fires off requests to this URL:

https://www.instagram.com/web/search/topsearch/?query={searchquery}

That returns a JSON feed which has a bunch of info on the user including a value for follower_count. If you are logged in, the results are weighted by relevance to your account, but you don't have to be authenticated or even logged in to get a result:

{
"has_more": false, 
"status": "ok", 
"hashtags": [], 
"users": [
            {
            "position": 0, 
            "user": {
                "username": "thenativepaul", 
                "has_anonymous_profile_picture": false, 
                "byline": "457 followers", 
                "mutual_followers_count": 0.0, 
                "profile_pic_url": "https://scontent-lhr3-1.cdninstagram.com/t51.2885-19/11373838_482400848607323_1803683048_a.jpg", 
                "full_name": "Paul Almeida-Seele", 
                "follower_count": 457, 
                "pk": 21072296, 
                "is_verified": false, 
                "is_private": false
                }
            }, 
            {
            "position": 1, 
            "user": {
                "username": "the_native_warrior", 
                "has_anonymous_profile_picture": false, 
                "byline": "251 followers", 
                "mutual_followers_count": 0.0, 
                "profile_pic_url": "https://scontent-lhr3-1.cdninstagram.com/t51.2885-19/s150x150/14473927_312669442422199_4605888521247391744_a.jpg", 
                "profile_pic_id": "1352745514521408299_1824600282", 
                "full_name": "Paul Carpenter", 
                "follower_count": 251, 
                "pk": 1824600282, 
                "is_verified": false, 
                "is_private": true
                }
            }
        ], 
"places": [ ]
}



回答3:


Using yahoo query language

https://query.yahooapis.com/v1/public/yql?q=select * from html where url='https://www.instagram.com/USERNAME/' and xpath='/html/body/script[1]'&format=json



回答4:


you can get any user's followers count but you cant get the user's followers details, you can only get your follower list.

This is API to get follower count of any user:

https://api.instagram.com/v1/users/{user-id}/?access_token=ACCESS-TOKEN

https://www.instagram.com/developer/endpoints/users/#get_users

UPDATE: I noticed that didn't work and I just tried this: https://api.instagram.com/v1/users/self/?access_token=XXXXX and got some good info ... MQ




回答5:


There are a few analytics tools that allow you to get the follower count without an access token other than your own. If you login to Crowdbabble and add an Instagram account, you will be asked to login to your Instagram account. After that, though, you can add any Instagram account and get the number of followers. This will give you the follower list, most engaging followers, and most influential followers for any account.

If you apply for the Instagram API (now requires a written application and a video submission), you can set up an app like this yourself. You can make calls to different accounts using just one access token.




回答6:


I've used yahoo API, in my case I figured out like this,

hope this helps someone because I've searched a lot for this.

$url = "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url=%27https://www.instagram.com/USERNAME/%27%20and%20xpath=%27/html/body/script[1]%27&format=json";
$json = file_get_contents($url);
$obj = json_decode($json, true);
$content = $obj['query']['results']['script']['content'];
$content = str_replace("window._sharedData =", "", $content);
$content = str_replace(";", "", $content);
$content = trim($content);
$json = json_decode($content);
$instagram_follower_count = $json->entry_data->ProfilePage{0}->user->followed_by->count;

anyone know better way get directly with JSON object, without replacing special characters ? please correct me if yes.



来源:https://stackoverflow.com/questions/34906301/how-to-get-other-pages-followers-count-number-in-instagram

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!