Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix two-factor, fix errors when connection lags, add stop when out of likes #13

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 36 additions & 11 deletions tinder_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,20 @@ def __init__(self):
def login(self):
self.driver.get('https://tinder.com')

sleep(2)
sleep(3)

#more_option = self.driver.find_element_by_xpath('//*[@id="modal-manager"]/div/div/div/div/div[3]/span/button')
#more_option.click()

fb_btn = self.driver.find_element_by_xpath('//*[@id="modal-manager"]/div/div/div/div/div[3]/div[2]/button')
#fb_btn = self.driver.find_element_by_xpath('//*[@id="modal-manager"]/div/div/div/div/div[3]/span/div[3]/button')
fb_btn = self.driver.find_element_by_xpath('//*[@id="modal-manager"]/div/div/div/div/div[3]/span/div[2]/button')
fb_btn.click()

sleep(2)

# switch to login popup
base_window = self.driver.window_handles[0]
self.driver.switch_to_window(self.driver.window_handles[1])
self.driver.switch_to.window(self.driver.window_handles[1])

email_in = self.driver.find_element_by_xpath('//*[@id="email"]')
email_in.send_keys(username)
Expand All @@ -28,20 +34,26 @@ def login(self):
login_btn = self.driver.find_element_by_xpath('//*[@id="u_0_0"]')
login_btn.click()

self.driver.switch_to_window(base_window)
try :
while self.driver.find_element_by_xpath('//*[@id="u_0_9"]'):
sleep(1)
except Exception:
self.driver.switch_to.window(base_window)

sleep(3)

popup_1 = self.driver.find_element_by_xpath('//*[@id="modal-manager"]/div/div/div/div/div[3]/button[1]')
popup_1.click()
popup_1 = self.driver.find_element_by_xpath('//*[@id="modal-manager"]/div/div/div/div/div[3]/button[1]')
popup_1.click()

popup_2 = self.driver.find_element_by_xpath('//*[@id="modal-manager"]/div/div/div/div/div[3]/button[1]')
popup_2.click()
popup_2 = self.driver.find_element_by_xpath('//*[@id="modal-manager"]/div/div/div/div/div[3]/button[1]')
popup_2.click()

def like(self):
like_btn = self.driver.find_element_by_xpath('//*[@id="content"]/div/div[1]/div/main/div[1]/div/div/div[1]/div/div[2]/button[3]')
like_btn = self.driver.find_element_by_xpath('//*[@id="content"]/div/div[1]/div/main/div[1]/div/div/div[1]/div/div[2]/div[4]/button')
like_btn.click()

def dislike(self):
dislike_btn = self.driver.find_element_by_xpath('//*[@id="content"]/div/div[1]/div/main/div[1]/div/div/div[1]/div/div[2]/button[1]')
dislike_btn = self.driver.find_element_by_xpath('//*[@id="content"]/div/div[1]/div/main/div[1]/div/div/div[1]/div/div[2]/div[2]/button')
dislike_btn.click()

def auto_swipe(self):
Expand All @@ -53,7 +65,13 @@ def auto_swipe(self):
try:
self.close_popup()
except Exception:
self.close_match()
try :
self.close_match()
except :
True




def close_popup(self):
popup_3 = self.driver.find_element_by_xpath('//*[@id="modal-manager"]/div/div/div[2]/button[2]')
Expand All @@ -63,5 +81,12 @@ def close_match(self):
match_popup = self.driver.find_element_by_xpath('//*[@id="modal-manager-canvas"]/div/div/div[1]/div/div[3]/a')
match_popup.click()

def out_of_likes(self):
likes_popup = self.driver.find_element_by_xpath('//*[@id="modal-manager"]/div/div/div[3]/button[2]')
if likes_popup:
likes_popup.click()
return 1

bot = TinderBot()
bot.login()
bot.auto_swipe()