Skip to content
This repository has been archived by the owner on Mar 2, 2024. It is now read-only.

Commit

Permalink
Hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
stanfortonski committed May 5, 2020
1 parent 2cec7a3 commit 2450ff9
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 24 deletions.
36 changes: 19 additions & 17 deletions executable.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,29 @@
# Date: 02.05.2020
# Proper Executable

import sys
from random import random
from driver import getDriver
from tinderlogin import TinderLogin
from tinderbot import TinderBot
from selenium.common.exceptions import NoSuchElementException

try:
driver = getDriver()
login = TinderLogin(driver)
bot = TinderBot(driver)
driver = getDriver()
login = TinderLogin(driver)
bot = TinderBot(driver)

login.logIn()
if login.isLogged():
while True:
try:
bot.perform()
if bot.getTotalActions() % 10 == 0:
bot.show()
except NoSuchElementException:
print('Warning: Can\'t find element.')
else:
print('Error: Failed to login to Tinder. Check your data or try later.')
except:
print('Error: Something was missing. Report me: https://github.com/stanfortonski/Tinder-Bot')
login.logIn()
if login.isLogged():
print('=== Tinder Perform ===')
while True:
try:
bot.perform()
if bot.getTotalActions() % 10 == 0:
bot.show()
except NoSuchElementException as e:
print(f'Error: {e}\nReport me: https://github.com/stanfortonski/Tinder-Bot')
sys.exit()
else:
print('Error: Failed to login to Tinder. Check your data or try later.')


7 changes: 4 additions & 3 deletions facebooklogin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from time import sleep
from config import Config
from selenium.common.exceptions import NoSuchElementException

class FacebookLogin:
def __init__(self, driver):
Expand All @@ -21,10 +22,10 @@ def logIn(self):
driver.find_element_by_xpath('//*[@id="u_0_b"]').submit()
sleep(6)
try:
element = driver.find_element_by_partial_link_text('Log out')
self.__isLogged = False
except:
element = driver.find_element_by_css_selector('input[type="search"]')
self.__isLogged = True
except NoSuchElementException:
self.__isLogged = False

def isLogged(self):
return self.__isLogged
12 changes: 8 additions & 4 deletions tinderlogin.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ def logIn(self):
self.__isLogged = 'tinder.com/app/recs' in driver.current_url
if self.__isLogged:
self.__closePopups()
driver.get('https://tinder.com/app/recs')
sleep(2)

def __logInViaGoogle(self):
driver = self.driver
Expand Down Expand Up @@ -78,8 +76,14 @@ def __closePopups(self):
sleep(2)
driver.find_element_by_xpath('/html/body/div[2]/div/div/div/div/div[3]/button[1]').click()
sleep(2)
driver.find_element_by_xpath('/html/body/div[2]/div/div/div[1]/a').click()
sleep(1)
try:
element = driver.find_element_by_xpath('/html/body/div[2]/div/div/div[1]/a')
element.click()
driver.get('https://tinder.com/app/recs')
sleep(2)
except NoSuchElementException:
pass


def isLogged(self):
return self.__isLogged

0 comments on commit 2450ff9

Please sign in to comment.