Can pass the boolean to enable input and click function for 2FA
app.py
two_fa=True# if don't need 2FA just pass False
bot.login(two_fa)
3. Swipe randomly
The video does swipe right simply. I just make that a little bit fun lol
tinder_bot.py
ifrand>0.5:try:ifdebug:print('swipe like')self.like()exceptException:try:self.close_popup()exceptException:self.close_match()else:ifdebug:print('swipe not like')self.not_like()
4. Display action
As you can see, I added debug to show action in the Terminal.
app.py
debug=True# if pass False, prints don't show up
bot.auto_swipe(debug)
5. Screenshot
If the script swipe right, it will take a screenshot and give a random string to a png file.
Get image url from the element (css background-image)
Get a webp and convert it
Save no.2 as a png
tinder_bot.py
deftake_screenshot(self):filename=self.randomString()+'.png'image=self.driver.find_element_by_xpath('//*[@id="content"]/div/div[1]/div/main/div[1]/div/div/div[1]/div/div[1]/div[3]/div[1]/div[1]/div/div[1]/div/div')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=Image.open(BytesIO(resp.content)).convert("RGB")im.save(filename,"png")
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.
tinder_bot.py
defnot_pay(self):popup=self.driver.find_element_by_xpath('//*[@id="modal-manager"]/div/div/div[3]/button[2]')popup.click()print('cannot swipe any more')print('will finish the program')
If you have a Facebook account and Tinder account, you can try this simple Tinder bot.