Skip to content

Instantly share code, notes, and snippets.

Created August 14, 2014 09:46
Show Gist options
  • Save rtt/5a2e0cfa638c938cca59 to your computer and use it in GitHub Desktop.
Save rtt/5a2e0cfa638c938cca59 to your computer and use it in GitHub Desktop.
example python tinderbot
# encoding: utf8 1,1 Top# encoding: utf8
import argparse
from datetime import datetime
import json
from random import randint
import requests
import sys
from time import sleep
headers = {
'app_version': '3',
'platform': 'ios',
fb_id = '{ your fb user id here }'
fb_auth_token = '{ your fb auth token here }'
class User(object):
def __init__(self, data_dict):
self.d = data_dict
def user_id(self):
return self.d['_id']
def ago(self):
raw = self.d.get('ping_time')
if raw:
d = datetime.strptime(raw, '%Y-%m-%dT%H:%M:%S.%fZ')
secs_ago = int("%s")) - int(d.strftime("%s"))
if secs_ago > 86400:
return u'{days} days ago'.format(days=secs_ago / 86400)
elif secs_ago < 3600:
return u'{mins} mins ago'.format(mins=secs_ago / 60)
return u'{hours} hours ago'.format(hours=secs_ago / 3600)
return '[unknown]'
def bio(self):
x = self.d['bio'].encode('ascii', 'ignore').replace('\n', '')[:50].strip()
except (UnicodeError, UnicodeEncodeError, UnicodeDecodeError):
return '[garbled]'
return x
def age(self):
raw = self.d.get('birth_date')
if raw:
d = datetime.strptime(raw, '%Y-%m-%dT%H:%M:%S.%fZ')
return - int(d.strftime('%Y'))
return 0
def __unicode__(self):
return u'{name} ({age}), {distance}km, {ago}'.format(
def auth_token(fb_auth_token, fb_user_id):
h = headers
h.update({'content-type': 'application/json'})
req =
data=json.dumps({'facebook_token': fb_auth_token, 'facebook_id': fb_user_id})
return req.json()['token']
return None
def recommendations(auth_token):
h = headers
h.update({'X-Auth-Token': auth_token})
r = requests.get('', headers=h)
if r.status_code == 401 or r.status_code == 504:
raise Exception('Invalid code')
print r.content
if not 'results' in r.json():
print r.json()
for result in r.json()['results']:
yield User(result)
def like(user_id):
u = '' % user_id
d = requests.get(u, headers=headers, timeout=0.7).json()
except KeyError:
return d['match']
def nope(user_id):
u = '' % user_id
requests.get(u, headers=headers, timeout=0.7).json()
except KeyError:
def like_or_nope():
return 'nope' if randint(1, 100) == 31 else 'like'
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Tinder automated bot')
parser.add_argument('-l', '--log', type=str, default='activity.log', help='Log file destination')
args = parser.parse_args()
print 'Tinder bot'
print '----------'
matches = 0
liked = 0
nopes = 0
while True:
token = auth_token(fb_auth_token, fb_id)
if not token:
print 'could not get token'
for user in recommendations(token):
if not user:
print unicode(user)
action = like_or_nope()
if action == 'like':
print ' -> Like'
match = like(user.user_id)
if match:
print ' -> Match!'
with open('./liked.txt', 'a') as f:
f.write(user.user_id + u'\n')
print ' -> random nope :('
print 'networking error %s' % user.user_id
s = float(randint(250, 2500) / 1000)
Copy link

efraim-il commented Dec 19, 2016

It doesn't work for me, why?

root@kali:~# ./
from: can't read /var/mail/datetime
from: can't read /var/mail/random
from: can't read /var/mail/time
./ line 11: headers: command not found
./ line 12: app_version:: command not found
./ line 13: platform:: command not found
./ line 14: syntax error near unexpected token }' ./ line 14: }'

Facebook ID and auth key is correct

Copy link

Just tried now again and got it working :-)
My FB_ID is extactly like this (untouched) > fb_id = '{ 12***91520 }'
and in the fb_auth_token I removed the { } from both sides, so it looks like that:

fb_auth_token = 'EAAGm0PX4ZCpsBADOHTeqmo5XQXLeQ73dDcHfZABUVqN14AmxmXHnNFEn5juZC1qynrInx9UpZAi5v0zrRn2ZArEZCUuiARwGIuMzmFaPvV5C114BuxhxqBinOuqHJtZBB*********************************************************************XsxnR3N8IonsOItFvHFuq9usZD'

Copy link

efraim-il commented Dec 21, 2016

networking error tinder_rate_limited_id_1482280511118_0
Tinder Team (25), 1km, -301 mins ago
-> Like
networking error tinder_rate_limited_id_1482280511118_1
Tinder Team (25), 1km, -300 mins ago
-> Like
networking error tinder_rate_limited_id_1482280511118_2
Tinder Team (25), 1km, -300 mins ago
-> Like
networking error tinder_rate_limited_id_1482280511118_3
Tinder Team (25), 1km, -300 mins ago
-> Like
networking error tinder_rate_limited_id_1482280511118_4
Tinder Team (25), 1km, -300 mins ago
-> Like
networking error tinder_rate_limited_id_1482280511118_5

Got this after like 2-3 minutes, how can I fix the script by adding some kind of sleep time ?
Edit: It's because it's a free user so the likes are limited, nothing to do with the script

Copy link

hi i want to tinder boot

Copy link

efraim-il commented Jan 18, 2017

Why after a few minutes I get an error "could not get token" ?

and sometimes I get an error after a few minutes

{u'status': 500, u'error': u''}
Traceback (most recent call last):
File "", line 141, in
for user in recommendations(token):
File "", line 95, in recommendations
for result in r.json()['results']:
KeyError: 'results'


I m trying this code but compiler giving me error in user_id. Help me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment