From 5181382dbf07bd73e652ff11c3e44708974d485f Mon Sep 17 00:00:00 2001 From: onemanbuilds <72015638+onemanbuilds@users.noreply.github.com> Date: Mon, 2 Nov 2020 18:29:55 +0100 Subject: [PATCH] update -added lang en option -removed headless mode -added wait before request -added a new method -added account creator (it was requested) -renamed browser amount print to threads --- proxies.txt => account_creator_proxies.txt | 0 main.py | 138 ++++++++++++++++++--- 2 files changed, 122 insertions(+), 16 deletions(-) rename proxies.txt => account_creator_proxies.txt (100%) diff --git a/proxies.txt b/account_creator_proxies.txt similarity index 100% rename from proxies.txt rename to account_creator_proxies.txt diff --git a/main.py b/main.py index 5b41354..f9a039d 100644 --- a/main.py +++ b/main.py @@ -11,6 +11,10 @@ from os import name,system from sys import stdout from concurrent.futures import ThreadPoolExecutor +from threading import Thread,Lock,active_count +from string import ascii_letters,digits +import json +import requests class Main: def clear(self): @@ -35,15 +39,103 @@ def PrintText(self,bracket_color:Fore,text_in_bracket_color:Fore,text_in_bracket stdout.write(Style.BRIGHT+bracket_color+'['+text_in_bracket_color+text_in_bracket+bracket_color+'] '+bracket_color+text+'\n') self.lock.release() - def GetRandomProxy(self): - proxies_file = self.ReadFile('proxies.txt','r') + def GetRandomProxyForStream(self): + proxies_file = self.ReadFile('streaming_http_proxies.txt','r') return choice(proxies_file) + def GetRandomProxyForAccountCreator(self): + proxies_file = self.ReadFile('account_creator_proxies.txt','r') + proxies = {} + if self.proxy_type == 1: + proxies = { + "http":"http://{0}".format(choice(proxies_file)), + "https":"https://{0}".format(choice(proxies_file)) + } + elif self.proxy_type == 2: + proxies = { + "http":"socks4://{0}".format(choice(proxies_file)), + "https":"socks4://{0}".format(choice(proxies_file)) + } + else: + proxies = { + "http":"socks5://{0}".format(choice(proxies_file)), + "https":"socks5://{0}".format(choice(proxies_file)) + } + return proxies + + def ReadFile(self,filename,method): with open(filename,method) as f: content = [line.strip('\n') for line in f] return content + def AddRandomDomain(self,username): + email_providers = ['gmail.com', 'yahoo.com', 'hotmail.com', 'hotmail.co.uk', 'hotmail.fr', 'outlook.com', 'icloud.com', 'mail.com', 'live.com', 'yahoo.it', 'yahoo.ca', 'yahoo.in', 'live.se', 'orange.fr', 'msn.com', 'mail.ru', 'mac.com'] + return username+'@'+choice(email_providers) + + def GenCredentails(self): + credentails = {} + credentails['gender'] = choice(['male', 'female']) + credentails['birth_year'] = randint(1970,2005) + credentails['birth_month'] = randint(1,12) + credentails['birth_day'] = randint(1,28) + password_characters = ascii_letters + digits + password_characters = ''.join(choice(password_characters) for i in range(randint(8,15))) + credentails['password'] = password_characters + username = ascii_letters + digits + username = ''.join(choice(username) for i in range(randint(7,11))) + credentails['username'] = username + email = self.AddRandomDomain(username) + credentails['email'] = email + return credentails + + def SpotifyCreator(self): + try: + create_headers = { + 'User-agent': 'S4A/2.0.15 (com.spotify.s4a; build:201500080; iOS 13.4.0) Alamofire/4.9.0', + 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8', + 'Accept': 'application/json, text/plain;q=0.2, */*;q=0.1', + 'App-Platform': 'IOS', + 'Spotify-App': 'S4A', + 'Accept-Language': 'en-TZ;q=1.0', + 'Accept-Encoding': 'gzip;q=1.0, compress;q=0.5', + 'Spotify-App-Version': '2.0.15' + } + + create_response = '' + + create_url = 'https://spclient.wg.spotify.com/signup/public/v1/account' + + + credentails = self.GenCredentails() + + payload = 'creation_point=lite_7e7cf598605d47caba394c628e2735a2&password_repeat={0}&platform=Android-ARM&iagree=true&password={1}&gender={2}&key=a2d4b979dc624757b4fb47de483f3505&birth_day={3}&birth_month={4}&email={5}&birth_year={6}'.format(credentails['password'],credentails['password'],credentails['gender'],credentails['birth_day'],credentails['birth_month'],credentails['email'],credentails['birth_year']) + + create_response = '' + + if self.use_proxy == 1: + create_response = requests.post(create_url, data=payload, headers=create_headers,proxies=self.GetRandomProxyForAccountCreator(),timeout=5) + else: + create_response = requests.post(create_url, data=payload, headers=create_headers) + + json_data = json.loads(create_response.text) + + if 'status' in json_data: + if json_data['status'] == 1: + username = json_data['username'] + if username != '': + self.PrintText(Fore.CYAN,Fore.RED,'CREATED','{0}:{1} | {2} | {3} | {4}/{5}/{6}'.format(credentails['email'],credentails['password'],credentails['username'],credentails['gender'],credentails['birth_year'],credentails['birth_month'],credentails['birth_day'])) + if self.method != 1: + self.Stream(credentails['email'],credentails['password']) + else: + self.SpotifyCreator() + else: + self.SpotifyCreator() + else: + self.SpotifyCreator() + except: + self.SpotifyCreator() + def Login(self,username,password,driver): try: logged_in = False @@ -71,22 +163,19 @@ def Login(self,username,password,driver): return logged_in except: driver.quit() - self.Login(username,password) + self.Login(username,password,driver) def Stream(self,username,password): - try: options = Options() - if self.headless == 1: - options.add_argument('--headless') - options.add_argument(f'--user-agent={self.GetRandomUserAgent()}') options.add_argument('no-sandbox') options.add_argument('--log-level=3') + options.add_argument('--lang=en') if self.use_proxy == 1: - options.add_argument('--proxy-server=http://{0}'.format(self.GetRandomProxy())) + options.add_argument('--proxy-server=http://{0}'.format(self.GetRandomProxyForStream())) #Removes navigator.webdriver flag options.add_experimental_option('excludeSwitches', ['enable-logging','enable-automation']) @@ -123,6 +212,7 @@ def Stream(self,username,password): def __init__(self): init(convert=True) + self.accounts = [] self.lock = Lock() self.clear() self.SetTitle('One Man Builds Spotify Streaming Tool Selenium') @@ -145,23 +235,39 @@ def __init__(self): """ print(self.title) + self.method = int(input(Style.BRIGHT+Fore.CYAN+'['+Fore.RED+'>'+Fore.CYAN+'] ['+Fore.RED+'1'+Fore.CYAN+']Stream From Combos.txt ['+Fore.RED+'0'+Fore.CYAN+']Generate Account Then Stream: ')) + self.use_proxy = int(input(Style.BRIGHT+Fore.CYAN+'['+Fore.RED+'>'+Fore.CYAN+'] ['+Fore.RED+'1'+Fore.CYAN+']Proxy ['+Fore.RED+'0'+Fore.CYAN+']Proxyless: ')) - self.headless = int(input(Style.BRIGHT+Fore.CYAN+'['+Fore.RED+'>'+Fore.CYAN+'] ['+Fore.RED+'1'+Fore.CYAN+']Headless ['+Fore.RED+'0'+Fore.CYAN+']Not Headless: ')) + + if self.use_proxy == 1 and self.method != 1: + self.proxy_type = int(input(Style.BRIGHT+Fore.CYAN+'['+Fore.RED+'>'+Fore.CYAN+'] ['+Fore.RED+'1'+Fore.CYAN+']Https ['+Fore.RED+'2'+Fore.CYAN+']Socks4 ['+Fore.RED+'3'+Fore.CYAN+']Socks5: ')) + self.minplay = int(input(Style.BRIGHT+Fore.CYAN+'['+Fore.RED+'>'+Fore.CYAN+'] Minimum time to stream: ')) self.maxplay = int(input(Style.BRIGHT+Fore.CYAN+'['+Fore.RED+'>'+Fore.CYAN+'] Maximum time to stream: ')) self.number_of_songs = int(input(Style.BRIGHT+Fore.CYAN+'['+Fore.RED+'>'+Fore.CYAN+'] Songs on the playlist: ')) - self.browser_amount = int(input(Style.BRIGHT+Fore.CYAN+'['+Fore.RED+'>'+Fore.CYAN+'] Browser amount: ')) + self.browser_amount = int(input(Style.BRIGHT+Fore.CYAN+'['+Fore.RED+'>'+Fore.CYAN+'] Threads: ')) + self.wait_before_start = int(input(Style.BRIGHT+Fore.CYAN+'['+Fore.RED+'>'+Fore.CYAN+'] Wait Before Start (seconds): ')) self.url = str(input(Style.BRIGHT+Fore.CYAN+'['+Fore.RED+'>'+Fore.CYAN+'] Stream url: ')) print('') def Start(self): - combos = self.ReadFile('combos.txt','r') - with ThreadPoolExecutor(max_workers=self.browser_amount) as ex: - for combo in combos: - username = combo.split(':')[0] - password = combo.split(':')[-1] + if self.method == 1: + combos = self.ReadFile('combos.txt','r') + with ThreadPoolExecutor(max_workers=self.browser_amount) as ex: + for combo in combos: + username = combo.split(':')[0] + password = combo.split(':')[-1] + ex.submit(self.Stream,username,password) + sleep(self.wait_before_start) + else: + while True: + if active_count()<= self.browser_amount: + Thread(target=self.SpotifyCreator).start() + sleep(self.wait_before_start) + - ex.submit(self.Stream,username,password) + + if __name__ == "__main__": main = Main()