summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2017-06-19 18:12:21 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2017-06-19 18:12:21 (GMT)
commit1cefbd13c36fe125d11ef4a650880ce18f84d4b0 (patch)
treed29c99201d4732131dbc45403b14f34cb4e60626
parente14370ac867d8b2963706ccc7d209fe0b7ff3364 (diff)
Displayed the amount of time to wait for before being able to like.
-rw-r--r--cupinder.py7
-rw-r--r--tinder.py29
2 files changed, 36 insertions, 0 deletions
diff --git a/cupinder.py b/cupinder.py
index e26c4f7..ade4f15 100644
--- a/cupinder.py
+++ b/cupinder.py
@@ -28,6 +28,13 @@ def connect():
print('[i] Remaining likes: %d' % tinder.get_remaining_likes())
+ wait = tinder.can_like_in()
+
+ if wait == 0:
+ print('[i] Time to like!')
+ else:
+ print('[i] We have to wait %d minute%s before liking...' % (wait, 's' if wait > 1 else ''))
+
return tinder
diff --git a/tinder.py b/tinder.py
index 7906a12..3b9858a 100644
--- a/tinder.py
+++ b/tinder.py
@@ -134,6 +134,35 @@ class TinderAPI(object):
return meta_dct['rating']['likes_remaining']
+ def can_like_in(self):
+ """Return the number of seconds before being allowed to issue likes."""
+
+ meta_dct = self._meta()
+
+ if 'rate_limited_until' in meta_dct['rating']:
+
+ now = int(time())
+
+ limited_until = meta_dct['rating']['rate_limited_until'] / 1000
+
+ diff = limited_until - now
+
+ if diff > 0:
+ if diff % 60 == 0:
+ wait = diff / 60
+ else:
+ wait = diff / 60 + 1
+
+ else:
+ wait = 0
+
+ else:
+
+ wait = 0
+
+ return wait
+
+
def get_recommendations(self, limit=10):
"""Get a fresh list of Tinder profiles."""