Advertisement
ayiemedia

sender2.py

Nov 1st, 2023
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. # Packages
  2. from selenium import webdriver
  3. from selenium.webdriver.chrome.service import Service
  4. from webdriver_manager.chrome import ChromeDriverManager
  5. from selenium.webdriver.common.action_chains import ActionChains
  6. from selenium.webdriver.common.keys import Keys
  7. from urllib.parse import quote
  8. import time
  9.  
  10. # Config
  11. login_time = 60 # Time for login (in seconds)
  12. new_msg_time = 5 # Time for a new message (in seconds)
  13. send_msg_time = 5 # Time for sending a message (in seconds)
  14. country_code = 60 # Set your country code
  15.  
  16. # Initialize the WebDriver with default Chrome profile
  17. driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
  18.  
  19. # Encode Message Text
  20. with open('message.txt', 'r') as msg_file:
  21. msg = quote(msg_file.read())
  22.  
  23. # Open browser with default link
  24. link = 'https://web.whatsapp.com'
  25. driver.get(link)
  26. time.sleep(login_time)
  27.  
  28. # Loop Through Numbers List
  29. with open('numbers.txt', 'r') as file:
  30. for n in file.readlines():
  31. num = n.rstrip()
  32. link = f'https://web.whatsapp.com/send/?phone={country_code}{num}&text={msg}'
  33. driver.get(link)
  34. time.sleep(new_msg_time)
  35. actions = ActionChains(driver)
  36. actions.send_keys(Keys.ENTER)
  37. actions.perform()
  38. time.sleep(send_msg_time)
  39.  
  40. # Quit the driver
  41. driver.quit()
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement