Last active
August 24, 2023 12:36
-
-
Save SyedAhkam/f99e68c2bbb89c11202e6c53de21a10a to your computer and use it in GitHub Desktop.
Scrape whatsapp group contact numbers
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
// Make this false if need to remove named contacts | |
const REMOVE_NAMES = true; | |
let numbers = document.querySelector("#main > header > div:nth-child(2) > div:nth-child(2) > span").title.split(",").map(e => e.trim()); | |
if (REMOVE_NAMES) { | |
numbers = numbers.filter(name => name.startsWith("+")); | |
} | |
console.log(numbers); | |
// Save to a txt file | |
const blob = new Blob([numbers.join("\n")], { type: "text/plain" }); | |
const url = URL.createObjectURL(blob); | |
const link = document.createElement("a"); | |
link.href = url; | |
link.download = "scraped_numbers.txt"; // can make this csv as well | |
link.style.display = "none"; | |
document.body.appendChild(link); | |
link.click(); | |
document.body.removeChild(link); | |
URL.revokeObjectURL(url); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment