-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtinder_bot.py
More file actions
90 lines (69 loc) · 3.16 KB
/
tinder_bot.py
File metadata and controls
90 lines (69 loc) · 3.16 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
from selenium import webdriver
from time import sleep
from sercrets import email, password
class TinderBot:
def __init__(self):
self.driver = webdriver.Chrome()
self.driver.get('https://tinder.com')
sleep(2)
def login(self):
login_btn = self.driver.find_element_by_xpath('//*[@id="content"]/div/div[1]/div/main/div[1]/div/div/header/div[1]/div[2]/div/button')
#login_btn = self.driver.find_element_by_xpath('//*[@id="o-1556761323"]/div/div[1]/div/main/div[1]/div/div/div/div/header/div/div[2]/div[2]/a')
#print(login_btn)
login_btn.click()
sleep(2)
fb_btn = self.driver.find_element_by_xpath('//*[@id="modal-manager"]/div/div/div[1]/div/div[3]/span/div[2]/button')
fb_btn.click()
sleep(2)
base_window = self.driver.window_handles[0]
self.driver.switch_to.window(self.driver.window_handles[1])
email_in = self.driver.find_element_by_xpath('//*[@id="email"]')
email_in.send_keys(email)
pw_in = self.driver.find_element_by_xpath('//*[@id="pass"]')
pw_in.send_keys(password)
login_btn = self.driver.find_element_by_xpath('//*[@id="u_0_0"]')
login_btn.click()
self.driver.switch_to.window(base_window)
input("continue login then press a key")
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[2]')
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]/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]/div[2]/button') # not sure
dislike_btn.click()
def close_popup1(self):
popup_3 = self.driver.find_element_by_xpath('//*[@id="modal-manager"]/div/div/button[2]') # super like popup
popup_3.click()
def close_popup2(self):
popup_4 = self.driver.find_element_by_xpath('//*[@id="modal-manager"]/div/div/div[2]/button[2]') # super like popup
popup_4.click()
def close_match(self):
match_popup = self.driver.find_element_by_xpath(
'//*[@id="modal-manager-canvas"]/div/div/div[1]/div/div[3]/a') # not sure
match_popup.click()
def auto_swipe(self):
input("press a key when ready to swipe")
while True:
sleep(0.5)
try:
self.like()
except Exception:
try:
self.close_popup1()
except Exception:
try:
self.close_popup2()
except Exception:
try:
self.close_match()
except Exception:
sleep(3)
bot = TinderBot()
bot.login()
bot.auto_swipe()