I have searched for a long time for an easy way to get general information about an Instagram user (#followers, name, bio, pic, etc) because the Graph API was too much hassle. I founded a way to do it with the Toolbox plugin.
Steps:
Instal the Toolbox plugin.
Make a button with the workflow: run javascript.
Put a JavascripttoBubble element on your page for each piece of data you want to extract.
Put the following code in the run javascript workflow:
let url = “https://www.instagram.com/**[username]**”;
$.ajax({
type: ‘GET’,
url: url,
error: function () {
//…
},
success: function (data) {
data = JSON.parse(data.split(“window._sharedData = “)[1].split(”;”)[0]).entry_data.ProfilePage[0].graphql;
console.log(data.user); bubble_fn_insta(data.user.edge_followed_by.count);
}
})
Change the [username] to the user you want to search
Change the bubble_fn_insta to the name of your JavascripttoBubble element
You can extract all data attached to data.user. To check the syntax, just run the workflow once with a valid username and check your console which displays all data you can extract and put into a JavascripttoBubble element.
I tried the same thing. But the shareddata which is exposed on the instagrampage is not visible on facebook. I think it is doable but I’m not such a coding guy.
Many thanks for your feedback @klaas.vanhoeck1 ! I will have a look. This really is a need I have for both Insta and FB, and your how to for Insta is a real game changer. So up to me to discover the how to for Facebook, and if I do, I will share the steps!
You should use the full name of the javascript to bubble element. So the 4th last line in your run javascript would be bubble_fn_JavascripttoBubble. Then it will be stored in that element which you can see in the debugger.
you need to go into the Rich Text Editor in the Workflow and replace every " or ’ with a new " or ’ and then run it. It will work. The problem is the copy and pasting over is putting the wrong kind of " or '. Found it on a stack overflow forum entry about the error code.
This is the data for the number of followers. I think as javascript to bubble element converts it to a text, this data type being a number is causing problems. Any idea how to solve this? I want to pull this number of followers data and use it as input in my form.
Make sure that the text box is filled using Dynamic Data “JavascripttoBubble’s value”, you can go one further and do it formatted as: and choose Number of something else.
VM15058:9 Uncaught TypeError: Cannot read property ‘0’ of undefined
at Object.success (eval at (PLUGIN_Toolbox-action–Run-javascript-.js:NaN), :9:95)
at i (x10:2)
at Object.fireWith [as resolveWith] (x10:2)
at A (x10:4)
at XMLHttpRequest. (x10:4)
Error is on this line:
data = JSON.parse(data.split(“window._sharedData = “)[1].split(”;”)[0]).entry_data.ProfilePage[0].graphql;
I am using the same code provided, and I switched out the ’ and " as well. Any ideas on how I can solve this? It is an issue with the CORs policy, but not sure if I can do anything about that in bubble.