一段可以批量筛选手机号是否注册了WhatsApp的有效代码,经验证有效;现在开源出来,代码如下:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
#Initialize the webdriver for Firefox
driver = webdriver.Firefox()
#Open the WhatsApp Web interface
driver.get(“https://web.whatsapp.com/”)
#Wait for the user to scan the QR code and log in
input(“Press Enter after scanning the QR code and logging in…”)
#Open the file containing the phone numbers
with open(“phone.txt”, “r”) as f:
for line in f:
#Strip any whitespace from the line
line = line.strip()
#Navigate to the WhatsApp Web search page
driver.get(f"WhatsApp Web“)
time.sleep(10) # wait for the page to load
#Check if the phone number is registered on WhatsApp
if driver.find_elements_by_xpath(”//button[contains(text(), ‘Send message’)]“):
print(f”{line} - Registered on WhatsApp")
else:
print(f"{line} - Not registered on WhatsApp")
#Close the webdriver
driver.quit()
添加客服微信咨询:
添加微信公众号加入万人群组交流: