Ledger Nano X - The secure hardware wallet
SHARE
TWEET

zz

a guest Apr 8th, 2020 278 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from selenium import webdriver
  2. from selenium.webdriver.firefox.options import Options
  3. import time
  4. import imaplib
  5. from bs4 import BeautifulSoup
  6. from selenium.webdriver.support.ui import WebDriverWait
  7. from selenium.webdriver.support import expected_conditions as EC
  8. from selenium.webdriver.common.by import By
  9.  
  10. def getCode(username, password):
  11.     imap_ssl_host = 'imap.gmail.com'
  12.     imap_ssl_port = 993
  13.     server = imaplib.IMAP4_SSL(imap_ssl_host, imap_ssl_port)
  14.     server.login(username, password)
  15.     server.select('Inbox')
  16.     status, data = server.search(None, 'ALL')
  17.     lel = (data[0].split())[-1]
  18.     status,data = server.fetch(lel,'(RFC822)')
  19.     email_msg = data[0][1]
  20.     zz = (email_msg.decode('utf-8')).split('</style>')
  21.     lol = zz[1] + '</body>'
  22.     soup = BeautifulSoup(lol, "lxml")
  23.     code = ((soup.findAll("p"))[0].text.split(": "))[1]
  24.     server.close()
  25.     server.logout()
  26.     return code
  27.  
  28. def main():
  29.     options = Options()  
  30.     gmail_username = ''
  31.     gmail_password = ''
  32.     options.headless = True
  33.     driver = webdriver.Firefox(options=options)
  34.     driver.get('https://www.twitch.tv/login')
  35.     username = driver.find_element_by_id("login-username")
  36.     password = driver.find_element_by_id("password-input")
  37.     username.send_keys("")
  38.     password.send_keys("")
  39.     driver.find_element_by_xpath('//button[@data-a-target="passport-login-button"]').click()
  40.     #WebDriverWait(driver, 15).until(EC.presence_of_element_located((By.XPATH, '//input[@data-a-target="tw-input"]'))) #a me da problemi, quindi uso un timer
  41.     time.sleep(15) #15 secondi sono un po' tanti ma almeno sono sicuro che si sia aggiornato + sia arrivato il codice
  42.     lmao = driver.find_element_by_xpath('//input[@data-a-target="tw-input"]')
  43.     code = getCode(gmail_username, gmail_password)
  44.     lmao.send_keys(code)
  45.     WebDriverWait(driver, 10).until(EC.url_changes(driver.current_url))
  46.     driver.get('https://www.twitch.tv/Yassuo')
  47.  
  48. if __name__ == '__main__':
  49.     main()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top