Grab Instagram Follower count

后端 未结 2 565
予麋鹿
予麋鹿 2021-02-06 00:43

So I have a question what would be the method to just grab the instagram follower count for a said user?

I have looked at two possible options the official instagram AP

2条回答
  •  无人共我
    2021-02-06 01:38

    The link from the accepted answer (https://www.instagram.com//?__a=1) no longer seems to work, but we can still get followers count from parsing the html from the normal profile url https://www.instagram.com/

    If you do a GET request, you'll get the plain HTML and you can search an html tag that looks like

    You can try it out in your browser by going to an Instagram profile, then right click and viewing the page source. Then it's just a matter of parsing the text to get the info you want.

    Here's an example to get the number of followers in javascript:

    var url = "https://www.instagram.com/username";
    request.get(url, function(err, response, body){
        if(response.body.indexOf(("meta property=\"og:description\" content=\"")) != -1){
            console.log("followers:", response.body.split("meta property=\"og:description\" content=\"")[1].split("Followers")[0])
        }
     });
    

    This is probably not a reliable, future-proof approach, but it does seem to work for now.

提交回复
热议问题