forked from rizwansoaib/whatsapp-monitor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
whatsapp-monitor.py
56 lines (40 loc) · 1.7 KB
/
whatsapp-monitor.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#! /usr/bin/python3
'''
Author- RIZWAN AHMAD
download https://github.com/mozilla/geckodriver/releases
set path paste binary file /usr/local/bin
sudo apt-get install libnotify-bin espeak
'''
from selenium import webdriver
import os
import time
driver = webdriver.Firefox()
driver.get("http://web.whatsapp.com")
os.system('notify-send "-i" call-start "Whatsapp Monitor Start" "Developed By RIZWAN AHMAD([email protected])"')
name=input("Please Enter Name for search online status: ")
while True:
try:
chat=driver.find_element_by_xpath("/html/body/div[1]/div/div/div[3]/div/header/div[2]/div/span/div[2]/div")
chat.click()
time.sleep(2)
search=driver.find_element_by_xpath("/html/body/div[1]/div/div/div[2]/div[1]/span/div/span/div/div[1]/div/label/input")
search.click()
time.sleep(2)
search.send_keys(name)
time.sleep(2)
open=driver.find_element_by_xpath("/html/body/div[1]/div/div/div[2]/div[1]/span/div/span/div/div[2]/div[1]/div/div/div[2]/div/div")
open.click()
time.sleep(2)
while True:
try:
status = driver.find_element_by_class_name("_315-i").text
name = driver.find_element_by_class_name("_19vo_").text
os.system('notify-send "-i" call-start "Whatsapp Monitor" "{0} {1} "'.format(name,status))
# -v=language en-us, f= 1 to 5 for male m ,s= speed,a= volume
os.system('espeak -ven-us+f4 -s140 -a 500 "{0} has {1} in whatsapp"'.format(name,status))
print("{0} {1}".format(name,status))
time.sleep(55)
except:
pass
except:
pass