Guest User

Vlare Notification Script

a guest
Jun 22nd, 2020
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.09 KB | None | 0 0
  1. from selenium import webdriver
  2. import time
  3. from pushbullet import Pushbullet
  4.  
  5. print("Pushbullet Vlare Notification Server")
  6.  
  7. pb = Pushbullet("PUSHBULLETAPIKEY")
  8. OldMessage = "none"
  9. OldNotNum = 420
  10.  
  11. #Start browser and go to page
  12. browser = webdriver.Firefox()
  13. browser.get('https://vlare.tv/group/2039')
  14.  
  15. #Info for logging in
  16. email = "email@example.com"
  17. password = "p4ssw0rd"
  18.  
  19. #Logging in
  20. LoginPageButton = browser.find_element_by_xpath("/html/body/main/header/nav/a[2]")
  21. LoginPageButton.click()
  22.  
  23. EmailInput = browser.find_element_by_xpath('//*[@id="signin_email"]')
  24. EmailInput.send_keys(email)
  25.  
  26. PasswordInput = browser.find_element_by_xpath('//*[@id="signin_password"]')
  27. PasswordInput.send_keys(password)
  28.  
  29. SignInButton = browser.find_element_by_xpath('//*[@id="sign_in_btn"]')
  30. SignInButton.click()
  31.  
  32. browser.get('https://vlare.tv/inbox')
  33. time.sleep(5)
  34.  
  35. #getnotification
  36. while True:
  37.     NotificationNumber = browser.find_element_by_xpath('/html/body/main/header/nav/div/a[3]/div')
  38.     CurrNotNum = NotificationNumber.text
  39.     if str(CurrNotNum) > str(OldNotNum):
  40.         browser.get('https://vlare.tv/inbox')
  41.         PostUsername = browser.find_element_by_xpath('/html/body/main/section/div/div[1]/div[4]/form/section/div[1]/div[2]')
  42.         PostHeader = browser.find_element_by_xpath('/html/body/main/section/div/div[1]/div[4]/form/section/div[1]/div[3]/strong')
  43.         PostMessage = browser.find_element_by_xpath('/html/body/main/section/div/div[1]/div[4]/form/section/div[1]/div[3]/span')
  44.         FirstOne = browser.find_element_by_xpath('/html/body/main/section/div/div[1]/div[4]/form/section/div[1]')
  45.         CurrMessage = PostMessage.text + PostHeader.text + PostUsername.text
  46.         if str(OldMessage) == str(CurrMessage):
  47.             debugmessage = 'Same Message'
  48.  
  49.         else:
  50.             pb.push_note(str(PostHeader.text),str(PostMessage.text))
  51.  
  52.             debugmessage = 'Pushed New Message'
  53.             print(debugmessage)
  54.  
  55.         OldMessage = CurrMessage
  56.     else:
  57.         debugmessage = 'Same Number of Messages'
  58.  
  59.     OldNotNum = CurrNotNum
  60.     time.sleep(5)
Add Comment
Please, Sign In to add comment