-
Notifications
You must be signed in to change notification settings - Fork 0
/
tinderBot.py
executable file
·66 lines (59 loc) · 2.47 KB
/
tinderBot.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
# Author: {
# 'Name': 'Shubhank'
#}
import json
from time import sleep
from selenium import webdriver
from cryptography.fernet import Fernet
class TinderBot():
def __init__(self):
self.myDriver = webdriver.Chrome('/usr/local/bin/chromedriver_linux64/chromedriver')
def login(self, eid, pw):
self.myDriver.get('https://tinder.com')
sleep(5)
fb_login = self.myDriver.find_element_by_xpath('//*[@id="modal-manager"]/div/div/div/div/div[3]/div[2]/button')
fb_login.click()
base_window = self.myDriver.window_handles[0]
sleep(2)
self.myDriver.switch_to_window(self.myDriver.window_handles[1])
emailID = self.myDriver.find_element_by_xpath('//*[@id="email"]')
emailID.send_keys(eid)
passw = self.myDriver.find_element_by_xpath('//*[@id="pass"]')
passw.send_keys(pw)
login_but = self.myDriver.find_element_by_xpath('//*[@id="u_0_0"]')
login_but.click()
sleep(2)
self.myDriver.switch_to_window(base_window)
allow_but = self.myDriver.find_element_by_xpath('//*[@id="modal-manager"]/div/div/div/div/div[3]/button[1]')
allow_but.click()
sleep(2)
enable_notif = self.myDriver.find_element_by_xpath('//*[@id="modal-manager"]/div/div/div/div/div[3]/button[1]')
enable_notif.click()
sleep(3)
self.autoSwipe()
def like(self):
like_but = self.myDriver.find_element_by_xpath('//*[@id="content"]/div/div[1]/div/main/div[1]/div/div/div[1]/div/div[2]/button[3]')
like_but.click()
def dislike(self):
dislike_but = self.myDriver.find_element_by_xpath('//*[@id="content"]/div/div[1]/div/main/div[1]/div/div/div[1]/div/div[2]/button[1]')
dislike_but.click()
def autoSwipe(self):
while True:
sleep(1)
try:
self.like()
except Exception:
try:
out_of_likes = self.myDriver.find_element_by_xpath('//*[@id="modal-manager"]/div/div/div[3]/button[1]')
out_of_likes.click()
self.myDriver.quit()
except Exception:
sleep(5)
def startSwipe(self):
with open('cred.config') as config:
Config = json.load(config)
eid = Config["username"]
key = Config["key"]
cipher_suite = Fernet(key)
pw = bytes(cipher_suite.decrypt(Config["pwHash"].encode())).decode("utf-8")
self.login(eid,pw)