forked from fbessez/Tinder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtinder_api_sms.py
232 lines (198 loc) · 7.4 KB
/
tinder_api_sms.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# coding=utf-8
import json
import config
import requests
headers = {
'app_version': '6.9.4',
'platform': 'ios',
"content-type": "application/json",
"User-agent": "Tinder/7.5.3 (iPhone; iOS 10.3.2; Scale/2.00)",
"X-Auth-Token": config.tinder_token,
}
def get_recommendations():
'''
Returns a list of users that you can swipe on
'''
try:
r = requests.get('https://api.gotinder.com/user/recs', headers=headers)
return r.json()
except requests.exceptions.RequestException as e:
print("Something went wrong with getting recomendations:", e)
def get_updates(last_activity_date=""):
'''
Returns all updates since the given activity date.
The last activity date is defaulted at the beginning of time.
Format for last_activity_date: "2017-07-09T10:28:13.392Z"
'''
try:
url = config.host + '/updates'
r = requests.post(url,
headers=headers,
data=json.dumps({"last_activity_date": last_activity_date}))
return r.json()
except requests.exceptions.RequestException as e:
print("Something went wrong with getting updates:", e)
def get_self():
'''
Returns your own profile data
'''
try:
url = config.host + '/profile'
r = requests.get(url, headers=headers)
return r.json()
except requests.exceptions.RequestException as e:
print("Something went wrong. Could not get your data:", e)
def change_preferences(**kwargs):
'''
ex: change_preferences(age_filter_min=30, gender=0)
kwargs: a dictionary - whose keys become separate keyword arguments and the values become values of these arguments
age_filter_min: 18..46
age_filter_max: 22..55
age_filter_min <= age_filter_max - 4
gender: 0 == seeking males, 1 == seeking females
distance_filter: 1..100
discoverable: true | false
{"photo_optimizer_enabled":false}
'''
try:
url = config.host + '/profile'
r = requests.post(url, headers=headers, data=json.dumps(kwargs))
return r.json()
except requests.exceptions.RequestException as e:
print("Something went wrong. Could not change your preferences:", e)
def get_meta():
'''
Returns meta data on yourself. Including the following keys:
['globals', 'client_resources', 'versions', 'purchases',
'status', 'groups', 'products', 'rating', 'tutorials',
'travel', 'notifications', 'user']
'''
try:
url = config.host + '/meta'
r = requests.get(url, headers=headers)
return r.json()
except requests.exceptions.RequestException as e:
print("Something went wrong. Could not get your metadata:", e)
def update_location(lat, lon):
'''
Updates your location to the given float inputs
Note: Requires a passport / Tinder Plus
'''
try:
url = config.host + '/passport/user/travel'
r = requests.post(url, headers=headers, data=json.dumps({"lat": lat, "lon": lon}))
return r.json()
except requests.exceptions.RequestException as e:
print("Something went wrong. Could not update your location:", e)
def reset_real_location():
try:
url = config.host + '/passport/user/reset'
r = requests.post(url, headers=headers)
return r.json()
except requests.exceptions.RequestException as e:
print("Something went wrong. Could not update your location:", e)
def get_recs_v2():
'''
This works more consistently then the normal get_recommendations becuase it seeems to check new location
'''
try:
url = config.host + '/v2/recs/core?locale=en-US'
r = requests.get(url, headers=headers)
return r.json()
except Exception as e:
print('excepted')
def set_webprofileusername(username):
'''
Sets the username for the webprofile: https://www.gotinder.com/@YOURUSERNAME
'''
try:
url = config.host + '/profile/username'
r = requests.put(url, headers=headers,
data=json.dumps({"username": username}))
return r.json()
except requests.exceptions.RequestException as e:
print("Something went wrong. Could not set webprofile username:", e)
def reset_webprofileusername(username):
'''
Resets the username for the webprofile
'''
try:
url = config.host + '/profile/username'
r = requests.delete(url, headers=headers)
return r.json()
except requests.exceptions.RequestException as e:
print("Something went wrong. Could not delete webprofile username:", e)
def get_person(id):
'''
Gets a user's profile via their id
'''
try:
url = config.host + '/user/%s' % id
r = requests.get(url, headers=headers)
return r.json()
except requests.exceptions.RequestException as e:
print("Something went wrong. Could not get that person:", e)
def send_msg(match_id, msg):
try:
url = config.host + '/user/matches/%s' % match_id
r = requests.post(url, headers=headers,
data=json.dumps({"message": msg}))
return r.json()
except requests.exceptions.RequestException as e:
print("Something went wrong. Could not send your message:", e)
def superlike(person_id):
try:
url = config.host + '/like/%s/super' % person_id
r = requests.post(url, headers=headers)
return r.json()
except requests.exceptions.RequestException as e:
print("Something went wrong. Could not superlike:", e)
def like(person_id):
try:
url = config.host + '/like/%s' % person_id
r = requests.get(url, headers=headers)
return r.json()
except requests.exceptions.RequestException as e:
print("Something went wrong. Could not like:", e)
def dislike(person_id):
try:
url = config.host + '/pass/%s' % person_id
r = requests.get(url, headers=headers)
return r.json()
except requests.exceptions.RequestException as e:
print("Something went wrong. Could not dislike:", e)
def report(person_id, cause, explanation=''):
'''
There are three options for cause:
0 : Other and requires an explanation
1 : Feels like spam and no explanation
4 : Inappropriate Photos and no explanation
'''
try:
url = config.host + '/report/%s' % person_id
r = requests.post(url, headers=headers, data={
"cause": cause, "text": explanation})
return r.json()
except requests.exceptions.RequestException as e:
print("Something went wrong. Could not report:", e)
def match_info(match_id):
try:
url = config.host + '/matches/%s' % match_id
r = requests.get(url, headers=headers)
return r.json()
except requests.exceptions.RequestException as e:
print("Something went wrong. Could not get your match info:", e)
def all_matches():
try:
url = config.host + '/v2/matches'
r = requests.get(url, headers=headers)
return r.json()
except requests.exceptions.RequestException as e:
print("Something went wrong. Could not get your match info:", e)
# def see_friends():
# try:
# url = config.host + '/group/friends'
# r = requests.get(url, headers=headers)
# return r.json()['results']
# except requests.exceptions.RequestException as e:
# print("Something went wrong. Could not get your Facebook friends:", e)