Saturday, 25 February 2017

Google script/Function to extract instagram followers

Below is a 4 line code that will extract the instagram followers

function getInstaFollowers(url) {
    var html = UrlFetchApp.fetch(url).getContentText();

    var testRE = html.match("description(.*)Followers");

    var xx=testRE[1].substring(11, testRE[1].length)
    var xx1=xx.replace(",", "");
    return xx1.trim();
     
}

go to tools ----> script editor -----> paste the above code ------> save the project -----> run the function -----> it will ask for permission ----> allow.

then go to your sheet and your instagram url is in cell A2, then in B2 use the formula =getInstaFollowers(A2)


No comments:

Post a Comment