Created
March 28, 2018 16:00
-
-
Save grhbit/bd68e505d4fb542adff43bf3c4e8bfb9 to your computer and use it in GitHub Desktop.
Downloads Instagram follower list as CSV format.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(() => { | |
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