Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Javascript Get Whatsapp Number in Group
phoneNumber = []
i = 0;
function saveArray() {
console.log('scroll down !');
nomor = document.querySelectorAll('._2sNbV ._25Ooe ._1wjpf');
nomor.forEach(element => {
n = element.getAttribute('title')
if (phoneNumber.indexOf(n) == -1) {
phoneNumber.push(n);
console.log('Add number : ' + n);
}
else {
console.log('skip duplicate : ' + n);
}
});
}
function getNumber() {
i = 0;
scrollSpeed = 50;
saveArrScroll = document.getElementsByClassName("_2sNbV")[0].addEventListener('scroll', saveArray);
batas = document.getElementsByClassName('AfVTG')[0].clientHeight;
getNumberInterval = setInterval(function(){
scrollDown = document.getElementsByClassName('_2sNbV')[0].scroll(0,i);
if (i > batas) {
clearInterval(getNumberInterval);
document.getElementsByClassName("_2sNbV")[0].removeEventListener('scroll', saveArrScroll);
console.log('OK Selesai ambil nomor');
console.log(phoneNumber);
prompt("Copy nomor ini", JSON.stringify(phoneNumber))
i = 0;
}
i += scrollSpeed;
console.log('scroll ' + i);
}, 100);
}
var start = confirm("Press OK! untuk mulai mengambil!");
if (start == true) {
try {
getNumber();
} catch (e) {
alert('ada kesalahan, pastikan sudah mengklik di group info pada grup Whatsapp Anda');
}
} else {
alert('batal');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.