def main(): print("let's begin ok") requests.packages.urllib3.disable_warnings() # Find way around this... config = configparser.ConfigParser(interpolation=None) config.read('config.ini') auth = str(config['DEFAULT']['FACEBOOK_AUTH_TOKEN']) session = None try: log("Trying to start Tinder session.") session = pynder.Session(str(config['DEFAULT']['FACEBOOK_ID']), auth) print("debug 1") except pynder.errors.RequestError: print("debug 2") log("Pynder Error. Trying to get new auth.") auth = get_access_token(str(config['DEFAULT']['FB_EMAIL']), str(config['DEFAULT']['FB_PASSWORD']), str(config['DEFAULT']['MOBILE_USER_AGENT']), str(config['DEFAULT']['FB_AUTH'])) config['DEFAULT']['FACEBOOK_AUTH_TOKEN'] = auth with open('config.ini', 'w') as configfile: config.write(configfile) config.read('config.ini') try: session = pynder.Session(str(config['DEFAULT']['FACEBOOK_ID']), auth) except pynder.errors.RequestError: log("Pynder Error. New auth did NOT work.") quit() #DO SOMETHING ON TINDER YA KNOW print("beep") print(session) print("boop")
def create_session(token = None, dir = None): # see if a directory for the fbid and token is supplied if dir: wd0 = os.getcwd() os.chdir(dir) token = open('token.txt').read() os.chdir(wd0) # see if token is supplied if token is None is dir is None: # check if it's in the working directory print('** searching current working directory for token') dirfiles = os.listdir() # open and read if found if 'token.txt' in dirfiles: token = open('token.txt').read() else: # suggest get_token() function print("** no token supplied. Use get_token() function to retrieve one") session = pynder.Session(token) user = session.profile.name print("** hello {0}, AutoTinder session initiated".format(user)) return(session)
def main(): # get input from other file f = open('variables.txt', 'r') FBID = f.readline().replace('\n', '') email = f.readline().replace('\n', '') password = f.readline().replace('\n', '') access_token = get_access_token(email, password) session = pynder.Session(facebook_id=FBID, facebook_token=access_token) users = session.nearby_users() hoes = itertools.islice(users, NUM_LOOPS) # print 'Num nearby users: {}'.format(users.size()) # matches = session.matches() # print 'Current number of matches: {}'.format(matches) print "Sequence Initializing" # print len(list(hoes)) i = 0 for hoe in hoes: wantsToBang = hoe.like() print '{} #{}'.format(wantsToBang, i) i += 1
def __init__(self, facebook_auth_token, beauty_score): # Authentification print("Starting the authentification.") self.beauty_score = beauty_score self.session = pynder.Session(facebook_token=facebook_auth_token) print("Authentification is succeeded. Access Token is %s" % facebook_auth_token) # Checking environments print("Checking LANG in environment variables.") print(sys.getdefaultencoding()) print(sys.stdout.encoding) # Create sessions self.session.matches() # get users you have already been matched with # self.session.update_location(LAT, LON) # updates latitude and longitude for your profile # self.session.profile # your profile. If you update its attributes they will be updated on Tinder. self.users = self.session.nearby_users() # returns a iterable of users nearby if self.users is None: print("Failed to fetch the list of nearby_users.") else: print("Success to fetch the list of nearby_users.") # Set config try: self.config = configparser.ConfigParser() self.config.read('./hacking_tinder/resources/config.ini') self.score_threshold = self.config["SCORE_THRESHOLD"] except Exception as e: print("Failed to read config. details : %s" % str(e)) sys.exit(1) print("Success to read config.")
def generateCSV(id_, token, timesleeping, csvname): if id is None or token is None: print("Facebook ID or Facebook Token not generated correctly") else: session = pynder.Session(facebook_id=id_, facebook_token=token) args = cf.get_args_db() cf.updateSearch(session, args.minAge, args.maxAge, args.maxDistance) search(session, timesleeping, csvname)
def do_connect(self): try: self.__session = pynder.Session(facebook_token=self.token) return True except pynder.errors.RequestError: return False except BaseException: return False
def get_session(): access_token = pynder_config['access_token'] try: access_token = get_token() except: pass session = pynder.Session(pynder_config['id'], access_token) return session
def doAutoLike(fbID, token): session = pynder.Session(facebook_id=fbID, facebook_token=token) near = session.nearby_users() for i in near: if session.likes_remaining == 0: telegramMessaging.sendMessage('Likes exhausted') break i.like()
def create_tinder_session(): """Creates a tinder session. Only works if token file is generated!""" token = get_fb_access_token_from_file() if token != None: fb_id = get_fb_id(token) return pynder.Session(fb_id, token) else: raise Exception("No token file. Run generate_token.py first")
def gettinderuser(): time.sleep(randint(0, 9)) session = pynder.Session(facebook_id, facebook_token) users = session.nearby_users() for j in range(len(users)): pdb.set_trace() user = users[j] user.bio = str( unicodedata.normalize('NFKD', user.bio).encode('ascii', 'ignore')) get_like_user(user)
def __init__(self, access_token, facebook_id, websocket_connection): """ Init function, this starts a new thread which periodically checks for new matches :param access_token: Tinder access token :param facebook_id: Facebook id :param websocket_connection: Websocket connection """ self.session = pynder.Session(facebook_token=access_token, facebook_id=facebook_id) self.websocket_connection = websocket_connection Thread(target=self.update_matches).start()
def start_session(): try: access_token = get_access_token('*****@*****.**', 'softdes') print('Succeeded in retrieve access token.') auth = str(access_token) except: log('Unable to get retrieve token.') try: access_token = get_access_token('*****@*****.**', 'softdes') print('Succeeded in retrieve access token.') auth = str(access_token) except: log('Unable to get retrieve token on second try. Shutting down...') quit() facebook_ID = 100025429656340 #taken from https://findmyfbid.com/ requests.packages.urllib3.disable_warnings() # Find way around this... config = configparser.ConfigParser(interpolation=None) config.read('config.ini') global session session = None log("Starting Tinder session...") try: session = pynder.Session(facebook_id=str(facebook_ID), facebook_token=auth) log("Session started.") except pynder.errors.RequestError: log("Session failed. Trying again to start session...") auth = get_access_token(str(pickupgenerator @ gmail.com), str(softdes)) try: pynder.Session(facebook_id=str(facebook_ID), facebook_token=auth) log("Session started.") except pynder.errors.RequestError: log("Unable to start session on second try. Shutting down and pickling..." ) pickle_all() quit()
def main(name, more_info): session = pynder.Session(facebook_token=FACEBOOK_ACCESS_TOKEN, facebook_id=FACEBOOK_ID) matches = session.matches() for match in matches: if str(match.user.name) == name: result = find_intel(more_info, match) if result: if result[1]: print "succeeded at revealing the instagram " save_result_to_file(result) print "couldn't find the last name" return print "you haven't made contact with", name
def get_session(self): parent_folder = os.path.dirname(os.path.realpath(sys.argv[0])) + "/" try: # Read token access_token_file = open(parent_folder + "access_token.txt", "r") access_token = access_token_file.read() access_token_file.close() session = pynder.Session(access_token) except Exception: # Update token access_token = self.get_facebook_token(FACEBOOK_USER, FACEBOOK_PASSWORD, parent_folder) access_token_file = open(parent_folder + "access_token.txt", "w") access_token_file.write(access_token) access_token_file.close() session = pynder.Session(access_token) print(Fore.GREEN + "[OK] Session Correctly gotten") return session
def setup(email, password): fb_token = _get_fb_token(email, password) parent_folder = logging_config.parent_folder try: # Read token access_token_file = open(parent_folder + email + "_access_token.txt", "r") access_token = access_token_file.read() access_token_file.close() session = pynder.Session(access_token) except Exception as e: # Update token access_token = _get_fb_token(email, password) access_token_file = open(parent_folder + email + "_access_token.txt", "w") access_token_file.write(access_token) access_token_file.close() session = pynder.Session(access_token) # Assert setup succeeded session._api.profile() return session
def start(self): #start file server self.server = subprocess.Popen(['python3 -m http.server 8000'], shell=True) #start tinder session self.log.info("Starting Session") self.session = pynder.Session(self.user_id, self.access_token) self.log.info(self.session.update_location( self.loc[0], self.loc[1])) # updates latitude and longitude for your profile self.log.info( "Logged in as: " + str(self.session.profile) ) # your profile. If you update its attributes they will be updated on Tinder. self.log.info("Searching for: " + self.target + " every " + str(self.interval) + " minutes")
def recAuth(fb_id=FB_ID, fb_token=FB_TOKEN, maxFails=MAXFAILS): session = None fails = 0 while session is None and fails < maxFails: try: session = pynder.Session(facebook_id=fb_id, facebook_token=fb_token) print('Login was successful!\n') except Exception as e: fails += 1 print(e) time.sleep(abs(1 + np.random.randn())) return session
def run(guiInput): # result = imagecompare.doComparison(guiInput["fileName"][0], "https://animals.sandiegozoo.org/sites/default/files/2016-11/animals_hero_lizards.jpg") # return result[1] phone_number = "15125228879" log_code = sendCode(phone_number) sms_code = input("Please enter the code you've received by sms") myToken = str(getToken(phone_number, sms_code, log_code)) print("Here is your Tinder token :" + myToken) session = pynder.Session(XAuthToken=myToken) session.update_location(guiInput['location'][0], guiInput['location'][1]) users = session.nearby_users(guiInput['radius']) i = 1 #itertools.islice(users, 10): #needs to stop using relative path, is only geting the first one basephoto = guiInput["fileName"][0] f = open("logfile.txt", "a") for user in users: match = False time.sleep(1) print(" ") print(i) i += 1 print("Name: " + str(user.name)) print("Insta: " + str(user.instagram_username)) print("Age: " + str(user.age)) matchPhotos = [] for url in user.photos: photoObject = [] for imageLoc in guiInput['fileName']: result = imagecompare.doComparison(imageLoc, url) if (result[0] < 3000 or result[1] > 0.4 or result[2] < 30 or result[3] > 0.4): match = True photo_tup = (url, result[0], result[1], result[2], result[3]) if (match): record_profile(user.name, str(user.age), str(user.distance_km), str(user.instagram_username), photo_tup)
def get_tinder_session(): """Gets a tinder session""" logged_in = False session = None while not logged_in: fb_token = get_access_token() # Get FB ID from access token fb_id = get_fb_id(fb_token) try: print "Creating Tinder session..." session = pynder.Session(fb_id, fb_token) print "Connected to Tinder!" save_access_token_to_file(fb_token) logged_in = True except pynder.errors.RequestError as request_error: print request_error.message delete_access_token_file() return session
def __init__(self): self.FBTOKEN = FBTOKEN self.FBID = FBID self.session = pynder.Session(self.FBID, self.FBTOKEN) self.session_users = [] self.session_matchs = [] # Initialize the users queue self.users_queue = Queue.Queue() # Initialize the matchs queue self.matchs_queue = Queue.Queue() # Run the populating task queue for the first time self.users_thread = None self.__run_task_to_pupulate_users() self.matchs_thread = None self.__run_task_to_populate_matchs()
def sign_in(command): inputs = command.split(' ') if len(inputs) < 3: return "Sign in like this: @tinderbot signin <Username> <Password>" fid, faut = None, None print(inputs) if inputs[1].startswith("faut"): fid, faut = inputs[2:4] else: username, password = inputs[1:3] faut = get_fb_access_token(username, password) fid = get_fb_id(faut) global signed_in signed_in = True print(fid) print(faut) global tinder_session tinder_session = pynder.Session(facebook_id=fid, facebook_token=faut) print(", ".join([x.name for x in tinder_session.get_fb_friends()])) return "Signed in!" if tinder_session else "Something went wrong"
def swipe(fb_id, email, password): auth_token = get_access_token(email, password) session = pynder.Session(facebook_id = fb_id, facebook_token = auth_token) lats = np.arange(32.882, 32.884, 0.0001) longs = np.arange(-117.235, -117.230, 0.0001) LAT = np.random.choice(lats, 1)[0] LONG = np.random.choice(longs, 1)[0] session.update_location(LAT, LONG) users = session.nearby_users() try: for user in users: if np.random.choice(2, 1, p=[0.1, 0.9])[0]: user.like() print('Liked {}'.format(user.name)) else: user.dislike() print('Disliked {}'.format(user.name)) time.sleep(np.random.choice(np.arange(5,15), 1)[0]) except: print('Ran out of users to swipe on :(')
def runBot(userName, password, id): token = get_access_token() id = "100023813949658" session = pynder.Session(id, token) users = getUsers(session) while session.likes_remaining > 0: for user in users: if isNotFriend(user): if ageFilter(user): if distanceFiler(user): if horoscope(user): session.like(user) printUserDetails(user) else: session.dislike(user) else: session.dislike(user) else: session.dislike(user) else: session.dislike(user) users = getUsers(session)
# -*- coding: utf-8 -*- # modules import numpy as np import pynder import time # FB user ID & FB token usrid = "your_facebook_id" # Facebook ID token = "your_facebook_token" # Facebook access token # latitude & longitude(In this example, these lat&lon show Kyoto St.) LAT = 34.985193 LON = 135.758595 session = pynder.Session(facebook_id=usrid, facebook_token=token) # logging in to Tinder account session.matches() session.update_location(latitude=LAT, longitude=LON) users = session.nearby_users() # getting information of neaby users print "You can swipe", session.likes_remaining, "times." for usr in users: rest = session.likes_remaining print "===swipe counter:", counter, "=======================" if rest == 0: print "Finished!!" break usr.like() # swiping right time.sleep(np.abs(2. + np.random.normal() * 3.))
def login(self, facebook_id, facebook_token): # login to Tinder using pynder session = pynder.Session(facebook_token) print('Hello ', session.profile) return session
m.message(msg) # return the right user object from some username def user_by_id(matches, m_id): for m in matches: if m.id == m_id: return m # raise exception/return other random user? return None # not sure what would be good to return here fb_id, token, preference, reden = facebook_conf( ) # pass in configuration if you want # need those named keywords session = pynder.Session(facebook_id=fb_id, facebook_token=token) # include preference and reden in msg_list msg_list = msg_list[:1] + [msg_list[1] % (preference, reden)] # check if previous conversation history exists # if not, create a new one if not os.path.isfile(args.history): conv_hist = Counter() # you can also get a list of matched users but that is less flexible # we can't save match objects, so try users? for m in list(session.matches()): conv_hist[m.id] = 0 save_conversation_history(conv_hist) conv_hist = conversation_history(args.history)
def logIn(self, id, token): self.session = pynder.Session(facebook_id=id, facebook_token=token)
from skimage.io import imread, imsave, imshow, show import pynder import matplotlib.pyplot as plt from helpers import get_access_token, get_login_credentials from io_helpers import save_image email, password, FBID = get_login_credentials() FBTOKEN = get_access_token(email, password) session = pynder.Session(facebook_id=FBID, facebook_token=FBTOKEN) print("Session started..") while True: users = session.nearby_users() for user in users: photos = user.get_photos() print("Fetched user photos..") for photo in photos: image = imread(photo) imshow(image) show() input_string = "Write 1 to like. Write 2 to dislike" ans = input(input_string).lower() if ans == "1": save_image(image, photo, True) else: save_image(image, photo, False)
###TINDER #Session = BOT1 import pynder FBID = FACEBOOK_TOKEN="CAAGm0PX4ZCpsBAGsJptWYeSdgFQVSvv8XUZBQdz8HB7bb1oBIDdu2PCsiReGV5rXpNLoj3byZCLhqFtrqUZBb4kprabvxyO8n4je4EzTbbk8Iec5Y97tX5eZB2qZBxBPbLdzNmZAJuZB7i28bqKaLD0MIAdMVeZC1tSnwVEm829ljIZB6TfwaDiNFhQ4ttjqWisbciaG7NSWE3xJUIsIj7dCUL" BOT1 = pynder.Session(FBID,FACEBOOK_TOKEN) #################################3 #spits JSON script #with likes for usr in BOT1.nearby_users(): usr.like() #################################### #names of nearby users print BOT1.nearby_users(): ###################################### #gives profile name of bot usr BOT1.profile #change location of usr to outback
import pynder import sys import os import traceback import logging from beauty_predict import want_to_like from skimage.io import imread, imsave, imshow, show, imsave APP_ROOT = os.path.dirname(os.path.abspath(__file__)) parent_path = os.path.dirname(APP_ROOT) parent_path = os.path.dirname(parent_path) facebook_auth_token = "TOKEN_HERE" session = pynder.Session(facebook_auth_token) #kwarg counter = 80 while True: try: print("Fetching users...") users = session.nearby_users() for user in users: photos = user.get_photos() name = user.name # Fetch user profile picure image = imread(next(photos)) imsave(parent_path + "/samples/image/tinder" + str(counter) + ".jpg", image) # image saved like = want_to_like("tinder" + str(counter) + ".jpg") if like: user.like() print("You liked " + name) else: