From 98402d1c8bff854d16a074c0280f7499e624540f Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Tue, 20 Jun 2017 23:42:41 +0200 Subject: Added support for Superlikes. --- cupinder.py | 22 ++++++++++++++++++++++ db.py | 10 ++++++++++ tinder.py | 11 +++++++++++ 3 files changed, 43 insertions(+) diff --git a/cupinder.py b/cupinder.py index ade4f15..7835ea1 100644 --- a/cupinder.py +++ b/cupinder.py @@ -45,6 +45,7 @@ if __name__=='__main__': parser.add_argument('-p', '--process', help='Process stored Tinder profiles', action='store_true') parser.add_argument('--dump-new', help='Extract newly stored Tinder profiles', action='store_true') parser.add_argument('--dump-all', help='Extract all stored Tinder profiles', action='store_true') + parser.add_argument('-s', '--superlike', help='Superlike a given Tinder profile using its ID', type=str) args = parser.parse_args() @@ -164,3 +165,24 @@ if __name__=='__main__': p.output() db.mark_profile_as_extracted(p) + + + elif args.superlike: + + tinder = connect() + + uid = args.superlike + + profile = db.load_profile(uid) + + tinder.superlike(uid) + + if profile: + + db.mark_profile_as_superliked(profile) + + print('[*] %s: ' % profile._name + config.COLOR_LIKE + 'superlike!' + config.COLOR_RESET) + + else: + + print('[*] ' + config.COLOR_LIKE + 'Superliked' + config.COLOR_RESET + ' ' + uid) diff --git a/db.py b/db.py index 7986156..d6f0aeb 100644 --- a/db.py +++ b/db.py @@ -236,6 +236,16 @@ class HumanKind(object): self._db.commit() + def mark_profile_as_superliked(self, profile): + """Update information about a Tinder profile in the database.""" + + values = (True, profile._id) + + cursor = self._db.cursor() + cursor.execute('UPDATE People SET superliked = ? WHERE uid = ?', values) + self._db.commit() + + def mark_profile_as_passed(self, profile): """Update information about a Tinder profile in the database.""" diff --git a/tinder.py b/tinder.py index 3b9858a..79a9479 100644 --- a/tinder.py +++ b/tinder.py @@ -202,6 +202,17 @@ class TinderAPI(object): raise ProcessingError() + def superlike(self, uid): + """Like a Tinder profile.""" + + data = self._post('/like/%s/super' % uid) + + # {'match': False, 'super_likes': {'alc_remaining': 0, 'allotment': 1, 'superlike_refresh_interval': 1, 'superlike_refresh_interval_unit': 'd', 'remaining': 0, 'superlike_refresh_amount': 5, 'new_alc_remaining': 0, 'resets_at': '2017-06-20T19:54:18.027Z'}, 'status': 200} + + if data['status'] != 200: + raise ProcessingError() + + def dislike(self, uid): """Dislike a Tinder profile.""" -- cgit v0.11.2-87-g4458