diff --git a/pynder/api.py b/pynder/api.py index 7fc6fc3..2f58616 100644 --- a/pynder/api.py +++ b/pynder/api.py @@ -74,11 +74,11 @@ def profile(self): def update_profile(self, profile): return self._post("/profile", profile) - def like(self, user): - return self._get("/like/{}".format(user)) + def like(self, user, content_hash, s_number): + return self._get("/like/{}?content_hash=\"{}\"&s_number=\"{}\"".format(user, content_hash, s_number)) - def dislike(self, user): - return self._get("/pass/{}".format(user)) + def dislike(self, user, content_hash, s_number): + return self._get("/pass/{}?content_hash=\"{}\"&s_number=\"{}\"".format(user, content_hash, s_number)) def message(self, user, body): return self._post("/user/matches/{}".format(user), @@ -93,8 +93,8 @@ def user_info(self, user_id): def ping(self, lat, lon): return self._post("/user/ping", {"lat": lat, "lon": lon}) - def superlike(self, user): - result = self._post("/like/{}/super".format(user)) + def superlike(self, user, content_hash, s_number): + result = self._post("/like/{}/super".format(user), {"content_hash": content_hash, "s_number": s_number}) if 'limit_exceeded' in result and result['limit_exceeded']: raise errors.RequestError("Superlike limit exceeded") return result diff --git a/pynder/constants.py b/pynder/constants.py index d6f2040..8792a3b 100644 --- a/pynder/constants.py +++ b/pynder/constants.py @@ -1,15 +1,17 @@ -API_BASE = 'https://api.gotinder.com' +API_BASE = "https://api.gotinder.com" -USER_AGENT = 'Tinder Android Version 6.4.1' +USER_AGENT = "Tinder/6.8.0 (iPhone; iOS 9.0.2; Scale/2.00)" HEADERS = { - "Content-Type": "application/json; charset=utf-8", - "User-Agent": USER_AGENT, - "Host": API_BASE, - "os_version": "1935", - "app-version": "371", - "platform": "android", # XXX with ios we run in an error - "Accept-Encoding": "gzip" + "x-client-version": "68023", + "app-version": "1824", + "Accept-Encoding": "gzip, deflate", + "platform": "ios", + "Accept-Language": "it;q=1, en-US;q=0.9", + "Accept": "*/*", + "Connection": "keep-alive", + "os_version": "90000000002", + "Content-type": "application/json; charset=utf-8" } GENDER_MAP = ["male", "female"] diff --git a/pynder/models/user.py b/pynder/models/user.py index b5ae386..f908aff 100644 --- a/pynder/models/user.py +++ b/pynder/models/user.py @@ -12,7 +12,7 @@ def __init__(self, data, session): self._data = data self.id = data['_id'] - SIMPLE_FIELDS = ("name", "bio", "birth_date", "ping_time") + SIMPLE_FIELDS = ("name", "bio", "birth_date", "ping_time", "content_hash", "s_number") for f in SIMPLE_FIELDS: setattr(self, f, data[f]) diff --git a/pynder/session.py b/pynder/session.py index a85ade3..f9e3d68 100644 --- a/pynder/session.py +++ b/pynder/session.py @@ -23,8 +23,8 @@ def nearby_users(self, limit=10): users = response['results'] if 'results' in response else [] ret = [] for u in users: - if not u["_id"].startswith("tinder_rate_limited_id_"): - ret.append(models.Hopeful(u, self)) + if not u["user"]["_id"].startswith("tinder_rate_limited_id_"): + ret.append(models.Hopeful(u["user"], self)) return ret def update_profile(self, profile):