Skip to content

Instantly share code, notes, and snippets.

@mxamber
Created June 19, 2019 11:53
Show Gist options
  • Save mxamber/482633e9a02f1a710d8c74713edaefcd to your computer and use it in GitHub Desktop.
Save mxamber/482633e9a02f1a710d8c74713edaefcd to your computer and use it in GitHub Desktop.
run this in the console on a twitter user's following / follower page to export the IDs of all their followers / followeds in a format suitable for blockchain import
var IDs = [];
var users = [];
var result = '{"users":[\n';
var elements = Array.prototype.slice.apply(document.querySelectorAll("div[role='listitem'] div[data-user-id][data-screen-name].ProfileCard"));
elements.forEach(function(element) {
var user = {id: element.getAttribute("data-user-id"), name: element.getAttribute("data-screen-name")};
IDs.push(user.id);
result += '{"id":"' + user.id + '"},\n';
});
result = result.slice(0, result.length-2);
result += '\n]}';
var element = document.createElement('a');
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + result);
element.setAttribute('download', "result.txt");
element.style.display = 'none';
document.body.appendChild(element);
element.click();
document.body.removeChild(element);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment