Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from selenium import webdriver
- import time
- from pushbullet import Pushbullet
- print("Pushbullet Vlare Notification Server")
- pb = Pushbullet("PUSHBULLETAPIKEY")
- OldMessage = "none"
- OldNotNum = 420
- #Start browser and go to page
- browser = webdriver.Firefox()
- browser.get('https://vlare.tv/group/2039')
- #Info for logging in
- email = "email@example.com"
- password = "p4ssw0rd"
- #Logging in
- LoginPageButton = browser.find_element_by_xpath("/html/body/main/header/nav/a[2]")
- LoginPageButton.click()
- EmailInput = browser.find_element_by_xpath('//*[@id="signin_email"]')
- EmailInput.send_keys(email)
- PasswordInput = browser.find_element_by_xpath('//*[@id="signin_password"]')
- PasswordInput.send_keys(password)
- SignInButton = browser.find_element_by_xpath('//*[@id="sign_in_btn"]')
- SignInButton.click()
- browser.get('https://vlare.tv/inbox')
- time.sleep(5)
- #getnotification
- while True:
- NotificationNumber = browser.find_element_by_xpath('/html/body/main/header/nav/div/a[3]/div')
- CurrNotNum = NotificationNumber.text
- if str(CurrNotNum) > str(OldNotNum):
- browser.get('https://vlare.tv/inbox')
- PostUsername = browser.find_element_by_xpath('/html/body/main/section/div/div[1]/div[4]/form/section/div[1]/div[2]')
- PostHeader = browser.find_element_by_xpath('/html/body/main/section/div/div[1]/div[4]/form/section/div[1]/div[3]/strong')
- PostMessage = browser.find_element_by_xpath('/html/body/main/section/div/div[1]/div[4]/form/section/div[1]/div[3]/span')
- FirstOne = browser.find_element_by_xpath('/html/body/main/section/div/div[1]/div[4]/form/section/div[1]')
- CurrMessage = PostMessage.text + PostHeader.text + PostUsername.text
- if str(OldMessage) == str(CurrMessage):
- debugmessage = 'Same Message'
- else:
- pb.push_note(str(PostHeader.text),str(PostMessage.text))
- debugmessage = 'Pushed New Message'
- print(debugmessage)
- OldMessage = CurrMessage
- else:
- debugmessage = 'Same Number of Messages'
- OldNotNum = CurrNotNum
- time.sleep(5)
Add Comment
Please, Sign In to add comment