Last active
August 29, 2015 14:06
-
-
Save charlierm/496a7f4292512937e433 to your computer and use it in GitHub Desktop.
Tinder autoliker script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Queue | |
import threading | |
import tinderClient | |
import json | |
import logging | |
logging.basicConfig(level=logging.DEBUG) | |
PRODUCER_THREADS = 3 | |
CONSUMER_THREADS = 10 | |
""" | |
Download https://github.com/Coriou/py-tinder/tree/master/tinder | |
Stick this script in the 'tinder' folder - Obviously this is a shit library but I am a lazy cunt and don't want to rewrite it. | |
Get your FB token from this URL | |
https://www.facebook.com/dialog/oauth?client_id=464891386855067&redirect_uri=https://www.facebook.com/connect/login_success.html&scope=basic_info,email,public_profile,user_about_me,user_activities,user_birthday,user_education_history,user_friends,user_interests,user_likes,user_location,user_photos,user_relationship_details&response_type=token | |
Run the fucking twat | |
""" | |
fb = { | |
'facebook_token': "YOUR FUCKING TOKEN", | |
'facebook_id': "712920247" | |
} | |
location = { | |
'lat': '51.4616116', | |
'lon': '-0.1340051' | |
} | |
t = tinderClient.tinderClient(fb) | |
# r = t.post_ping() - If you want to update the location | |
q = Queue.Queue() | |
def producer(pid): | |
""" | |
Gets tinder matches and adds them to queue | |
""" | |
logging.info("Producer {} started".format(pid)) | |
while True: | |
try: | |
results = t.get_recs() | |
for result in results['results']: | |
q.put(result) | |
logging.debug(u'Match added to queue: {}'.format(result[u'name'])) | |
logging.info('{} Matches added to queue'.format(len(results['results']))) | |
except Exception as e: | |
logging.info("No results remaining to add to queue") | |
print(results) | |
print(e) | |
break | |
def consumer(cid): | |
""" | |
Pulls matches off queue and matches them. | |
""" | |
logging.info("Consumer {} started".format(cid)) | |
while True: | |
try: | |
match = q.get(block=True, timeout=5) | |
t.get_like(match['_id']) | |
logging.debug(u"Match liked: {}".format(match[u'name'])) | |
except Queue.Empty as e: | |
logging.info("Queue is empty - stopping thread") | |
break | |
threads = [] | |
#Start Producers | |
for i in range(0, PRODUCER_THREADS): | |
thread = threading.Thread(target=producer, args=(i,)) | |
threads.append(thread) | |
#Start Consumers | |
for i in range(0, CONSUMER_THREADS): | |
thread = threading.Thread(target=consumer, args=(i,)) | |
threads.append(thread) | |
#Start and join all threads | |
[x.start() for x in threads] | |
[x.join() for x in threads] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment