From 96b629bebc7515f95bacd0fb6d59252e905cee4b Mon Sep 17 00:00:00 2001 From: Muhammad Ibrahim Date: Sat, 30 Nov 2024 08:30:46 +0530 Subject: [PATCH] Added the Tinder dating app script --- Visual Studio Code Projects/tinder-finder.py | 70 ++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 Visual Studio Code Projects/tinder-finder.py diff --git a/Visual Studio Code Projects/tinder-finder.py b/Visual Studio Code Projects/tinder-finder.py new file mode 100644 index 0000000..2404d5b --- /dev/null +++ b/Visual Studio Code Projects/tinder-finder.py @@ -0,0 +1,70 @@ +from selenium import webdriver +from selenium.webdriver.common.by import By +from selenium.webdriver.common.keys import Keys +from selenium.common.exceptions import ElementClickInterceptedException, NoSuchElementException +from time import sleep + +FB_EMAIL = "YOUR FACEBOOK LOGIN EMAIL" +FB_PASSWORD = "YOUR FACEBOOK PASSWORD" + +driver = webdriver.Chrome() + +driver.get("http://www.tinder.com") + +sleep(2) +login_button = driver.find_element(By.XPATH, value='//*[text()="Log in"]') +login_button.click() + +sleep(2) +fb_login = driver.find_element(By.XPATH, value='//*[@id="modal-manager"]/div/div/div[1]/div/div[3]/span/div[2]/button') +fb_login.click() + +sleep(2) +base_window = driver.window_handles[0] +fb_login_window = driver.window_handles[1] +driver.switch_to.window(fb_login_window) +print(driver.title) + +email = driver.find_element(By.XPATH, value='//*[@id="email"]') +password = driver.find_element(By.XPATH, value='//*[@id="pass"]') +email.send_keys(FB_EMAIL) +password.send_keys(FB_PASSWORD) +password.send_keys(Keys.ENTER) + +driver.switch_to.window(base_window) +print(driver.title) + +sleep(5) + +allow_location_button = driver.find_element(By.XPATH, value='//*[@id="modal-manager"]/div/div/div/div/div[3]/button[1]') +allow_location_button.click() + +notifications_button = driver.find_element(By.XPATH, value='//*[@id="modal-manager"]/div/div/div/div/div[3]/button[2]') +notifications_button.click() + +cookies = driver.find_element(By.XPATH, value='//*[@id="content"]/div/div[2]/div/div/div[1]/button') +cookies.click() + +#Tinder free tier only allows 100 "Likes" per day. If you have a premium account, feel free to change to a while loop. +for n in range(100): + + #Add a 1 second delay between likes. + sleep(1) + + try: + print("called") + like_button = driver.find_element(By.XPATH, value= + '//*[@id="content"]/div/div[1]/div/main/div[1]/div/div/div[1]/div/div[2]/div[4]/button') + like_button.click() + + #Catches the cases where there is a "Matched" pop-up in front of the "Like" button: + except ElementClickInterceptedException: + try: + match_popup = driver.find_element(By.CSS_SELECTOR, value=".itsAMatch a") + match_popup.click() + + #Catches the cases where the "Like" button has not yet loaded, so wait 2 seconds before retrying. + except NoSuchElementException: + sleep(2) + +driver.quit() \ No newline at end of file