summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2017-06-20 21:42:41 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2017-06-20 21:42:41 (GMT)
commit98402d1c8bff854d16a074c0280f7499e624540f (patch)
tree61cad8f6e15484b32b37aa4940de1ff89bca10f9
parent13d8fa8f46e644ecc591f09b1a386759fc53d19e (diff)
Added support for Superlikes.
-rw-r--r--cupinder.py22
-rw-r--r--db.py10
-rw-r--r--tinder.py11
3 files changed, 43 insertions, 0 deletions
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."""