Skip to content

Instantly share code, notes, and snippets.

@grhbit
Created March 28, 2018 16:00
Show Gist options
  • Save grhbit/bd68e505d4fb542adff43bf3c4e8bfb9 to your computer and use it in GitHub Desktop.
Save grhbit/bd68e505d4fb542adff43bf3c4e8bfb9 to your computer and use it in GitHub Desktop.
Downloads Instagram follower list as CSV format.
(() => {
let req = new XMLHttpRequest(),
page = _sharedData.entry_data.ProfilePage,
user = page[page.length-1].graphql.user,
url = `/graphql/query/?query_hash=37479f2b8209594dde7facb0d904896a&variables={"id":"${user.id}","first":${user.edge_followed_by.count}}`;
if (!confirm(`${user.full_name}?`))
return;
req.onloadend = () => {
if (req.status != 200)
return alert('too many follower!')
let contents = 'Username,Full Name,Pic,Id\n';
JSON.parse(req.response).data.user.edge_followed_by.edges.forEach(({ node }) => {
contents += `"${node.username}","${node.full_name}","${node.profile_pic_url}","${node.id}"\n`;
});
let a = document.createElement("a");
document.body.appendChild(a);
a.style = "display: none";
a.href = window.URL.createObjectURL(new Blob([contents], {type: "octet/stream"}));
a.download = `${user.full_name}-follower.csv`;
a.click();
window.URL.revokeObjectURL(a.href);
};
req.open('GET', url);
req.send();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment