-
Notifications
You must be signed in to change notification settings - Fork 7
/
creator.py
75 lines (62 loc) · 2.67 KB
/
creator.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import ElementNotVisibleException
from random import randint
import time
import os
import random
import polling2 as polli
from selenium.webdriver.common.proxy import Proxy, ProxyType
firefox_capabilities = webdriver.DesiredCapabilities.FIREFOX
firefox_capabilities['marionette'] = True
def proxy_change():
line = open('proxy.txt').read().splitlines()
proxy = random.choice(line)
print("now using " + proxy)
firefox_capabilities['proxy'] = {
"proxyType": "MANUAL",
"sslProxy": proxy
}
proxy_change()
browser = webdriver.Firefox(capabilities=firefox_capabilities)
def test(): #polls until it finds something, essential for account detection process
if browser.find_element_by_css_selector('.SubredditPicker__subreddits').is_displayed():
browser.quit()
time.sleep(randint(1,2))
print("Starting new instance")
proxy_change()
create_account()
else:
print("Waiting for captcha to be solved")
def create_account():
#get reddit account creation page
browser.set_window_size(683, 744)
browser.get('http://reddit.com/account/register/')
#insert username
time.sleep(randint(1,2))
browser.find_element_by_id('regEmail').click()
browser.find_element_by_id('regEmail').send_keys("[email protected]")
browser.find_element_by_css_selector('button.AnimatedForm__submitButton:nth-child(1)').click()
#clicks the submit button
time.sleep(randint(1,2))
#now the account insertion into the .txt file
with open('created_accounts.txt','a') as file:
file.write(browser.find_element_by_class_name('Onboarding__usernameSuggestion').text + "\n")
file.close()
browser.find_element_by_css_selector('a.Onboarding__usernameSuggestion:nth-child(1)').click()
#chooses the first random username
#insert password
time.sleep(randint(1,2))
browser.find_element_by_id('regPassword').click()
browser.find_element_by_id('regPassword').send_keys("WRITEYOURPASSWORDHERE")
browser.find_element_by_css_selector('button.AnimatedForm__submitButton:nth-child(3)' ).click() #clicks signup to show captcha
#pause to manually enter captcha
print("Enter Captcha")
#account creation detection
polli.poll(lambda: test(),step=1, timeout=120)
create_account()