Skip to content

Instantly share code, notes, and snippets.

@KeithNdhlovu
Created June 9, 2016 12:07
Show Gist options
  • Save KeithNdhlovu/5b9a7cb279e1cff74084bb4ef713df32 to your computer and use it in GitHub Desktop.
Save KeithNdhlovu/5b9a7cb279e1cff74084bb4ef713df32 to your computer and use it in GitHub Desktop.
Since Whatsap Doesnt have an Option to Export contacts in a group, and they only display username, and status, exporting contacts out of one group is straneous, so i made this
var groupList = document.getElementsByClassName("infinite-list-viewport")[0];
var contactList = groupList.getElementsByClassName("infinite-list-item");
var users = [];
for(var cc = 0; cc < contactList.length; cc++){
var name = contactList[cc].getElementsByClassName("chat-title")[0].getElementsByTagName("span")[0].getAttribute("title");
var contactDOM = contactList[cc].getElementsByClassName("chat-title")[0].getAttribute("data-reactid");
var reallNumber = contactDOM.replace(".0.0:$main.3.2.$=10.1:1.2.1:1.0.0.$", "");
reallNumber = reallNumber.substr(0, reallNumber.indexOf("@c=1us"));
users.push({name, reallNumber});
console.log("User : "+name+", Number : "+reallNumber);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment