DEV Community

Cover image for Create Tinder Bot with Python

Posted on

Create Tinder Bot with Python

Watched this youtube video.

The code is based on the video. I added a couple of things to it.

1. Allow a user to input username/password instead of using python file

# input email/username
email_input = self.driver.find_element_by_xpath('//*[@id="email"]')
username = getpass.getpass('please input username\n')

# input password
password_input = self.driver.find_element_by_xpath('//*[@id="pass"]')
password = getpass.getpass('please input password\n')
Enter fullscreen mode Exit fullscreen mode

2. Support 2FA

Can pass the boolean to enable input and click function for 2FA

two_fa = True # if don't need 2FA just pass False
Enter fullscreen mode Exit fullscreen mode

3. Swipe randomly

The video does swipe right simply. I just make that a little bit fun lol

if rand > 0.5:
        if debug:
            print('swipe like')
    except Exception:
        except Exception:
    if debug:
        print('swipe not like')
Enter fullscreen mode Exit fullscreen mode

4. Display action

As you can see, I added debug to show action in the Terminal.

debug = True # if pass False, prints don't show up
Enter fullscreen mode Exit fullscreen mode

5. Screenshot

If the script swipe right, it will take a screenshot and give a random string to a png file.

Alt Text

  1. Get image url from the element (css background-image)
  2. Get a webp and convert it
  3. Save no.2 as a png

def take_screenshot(self):
      filename = self.randomString()+'.png'
      image = self.driver.find_element_by_xpath(
      image_url = image.value_of_css_property("background-image")
      raw_url = image_url.replace('url("', '').replace('")', '')
      # get webp
      # convert webp --> png
      resp = requests.get(raw_url)
      im ="RGB"), "png")
Enter fullscreen mode Exit fullscreen mode

From an image, we could get a couple of things like name, age, one-line profile and Instagram username with pytesseract (OCR package)
This is not necessary since we can get them from the website directly lol

6. Terminate

As you may know, Tinder's biz model is a subscription model, so if you don't pay, Tinder will show you a popup that recommends you to purchase a subscription. This script is for fun and I don't use Tinder, so I need to terminate a program instead of aborting by an error.

def not_pay(self):
    popup = self.driver.find_element_by_xpath(
    print('cannot swipe any more')
    print('will finish the program')
Enter fullscreen mode Exit fullscreen mode

If you have a Facebook account and Tinder account, you can try this simple Tinder bot.



python and pypi versions

python 3.6.5 selenium 3.141.0 requests 2.22.0 Pillow 6.2.0


how to use

install webdriver

$ brew cask install chromedriver
# check version
$ chromedriver --version
Enter fullscreen mode Exit fullscreen mode

run python script

$ git clone
$ cd tinder-bot
$ pip install -r requirements.txt
Enter fullscreen mode Exit fullscreen mode

Maybe you are interested in doing something with javascript instead of using python.

Icons made by Freepik from

Top comments (1)