Skip to content

lucianohandal/tinder-bot

 
 

Repository files navigation

Contributors Forks Python Badge MIT License LinkedIn


TINDER AUTO-SWIPE BOT

Tinder web automation and scraper to swipe based on user training. Built with Selenium and Keras in Python.
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents

About The Project


This project started with the motivation of learning web automation and scraping with Python. After succesfully creating a bot that could:

  • Open a browser
  • Login to Tinder.com
  • Accept all notifications and dismiss pop-ups
  • Swipe right or left 100% of the times

I decided to add a deep learning model to predict the probability of likelyhood of a given user. The model I used is a Convolutional Neural Network trained from scratch with more than 10,000 images scraped from Tinder. The model consists of 5 convolutional layers and 3 dense layers.

This yielded a total of around 1,000,000 trainable parameters for 300x300 grayscale images and took about 6 hours to train 20 epochs with a batches of 50.

Built With

Getting Started

To get a local copy up and running follow these simple steps.

Prerequisites

  • Environment running python 3.6
  • Tinder account with Facebook login enabled

Installation

  1. Clone the repo
git clone https://github.com/lhandal/tinder-bot.git
  1. Install required packages
pip install -r requirements.txt

Usage

Option 1 - Training Your Own Model

  1. First and foremost open the secrets.py file and input your Facebook credentials to be able to login to Tinder.

  2. If you have your own images for training, skip to step 4. Else the scraping script can be used. Just add the directory to save the pictures in the variable pictures_folder inside the script and run. If you want, you can also configure the scraper to swipe right or left as it gathers the pictures.

  3. You will have to label all the images to be predicted as 1 by adding "yay_" before the file name and the ones to be predicted as 0 with "nay_".

  4. Add the path where you have the images to the path variable inside the train_script.py script and run it. This should take a while, depending on how many images you have scraped. The script will generate a .h5 model file inside the same folder -- this is the trained model.

Example

I used a model consisting of 5 convolutional layers and 3 dense layers, with pooling and normalization between layers. I also added some dropouts to avoid overfitting:

model = Sequential()
model.add(Convolution2D(32, kernel_size = (3, 3), activation='relu', input_shape=(IMG_SIZE, IMG_SIZE, 1)))
model.add(MaxPooling2D(pool_size=(2,2)))
model.add(BatchNormalization())

model.add(Convolution2D(64, kernel_size=(3,3), activation='relu'))
model.add(MaxPooling2D(pool_size=(2,2)))
model.add(BatchNormalization())

model.add(Convolution2D(96, kernel_size=(3,3), activation='relu'))
model.add(MaxPooling2D(pool_size=(2,2)))
model.add(BatchNormalization())

model.add(Convolution2D(96, kernel_size=(3,3), activation='relu'))
model.add(MaxPooling2D(pool_size=(2,2)))
model.add(BatchNormalization())

model.add(Convolution2D(64, kernel_size=(3,3), activation='relu'))
model.add(MaxPooling2D(pool_size=(2,2)))
model.add(BatchNormalization())
model.add(Dropout(0.2))
model.add(Flatten())

model.add(Dense(256, activation='relu'))
model.add(Dropout(0.2))

model.add(Dense(128, activation='relu'))
model.add(Dropout(0.3))

model.add(Dense(1, activation = 'sigmoid'))

This model yielded very good results consideing I only trained 10,000 grayscale pictures (grayscale to reduce the number of dimensions), but feel free to modify it as you consider best.

The end results after training were:

Accuracy (test): 89% 
Precision 84%
Recall: 64%

Option 2 - Use the Pre-trained Model

  1. If you don't want to train your own model, I have included the model I trained for this project. It is under model_03.h5.

Disclaimer: This model has been trained using the information I had available at the moment. It may not reflect in any way what I consider to be any standard for beauty. This is a sample project and is prone to mistakes.

Running the Bot

  1. If you haven't already done so, open the secrets.py file and input your Facebook credentials to be able to login to Tinder.

  2. Open the tinder_bot.py script and change the pictures_folder variable to any path you like. This is a temporary folder for the model to store each image and analyze it. It will be deleted later. By default this is the tmp/ folder.

  3. Change the model variable to whatever model you want to use. The default is set to model_03.h5 which I used to test the bot. \

  4. (Optional) You can also later on change the threshold var to regulate the "pickyness" of the bot. Default is set to 70%.

  5. Save the changes and run the script. You can run it from the terminal with

    python -i tinder_bot.py

    or open the run_bot executable file.

Roadmap

See the open issues for a list of proposed features (and known issues).

TODOs

  • Add face recognition and body recognition to improve accuracy.
  • Implement the posibility to use the Tinder API to avoid automation errors.
  • Add Google and Phone login options for Tinder
  • Train using color images to improve accuracy.

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Leandro Handal

Project Link: https://https://github.com/lhandal/tinder-bot

Acknowledgements

Special tahnks to aj-4 for the selenium guidance video!

About

Tinder.com web automation and scraper + deep learning predictive model for swiping

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%