예제 #1
0
 def chooseLike(self):
     ti.like(self.id)
     if (self.df.iloc[self.profileNum]['disliked'] == 1):
         self.df.at[self.profileNum, 'disliked'] = 0
         os.remove(f"./data/images/disliked/{self.id}.jpg")
     self.df.at[self.profileNum, 'liked'] = 1
     shutil.copy(f"./data/images/unlabeled/{self.id}.jpg",
                 f"./data/images/liked/{self.id}.jpg")
     self.nextID()
예제 #2
0
 def find_matches(self, results):
     starting_time = util.get_time()
     for idx, rec in enumerate(results):
         tinder_api.like(rec['_id'])
         print('Liked ' + rec['name'])
         event_emitter.emit_like(rec['_id'])
         if idx % 5 == 0:
             matches = tinder_api.get_updates(starting_time)
             print(matches)
         self.socketSleep(2)
예제 #3
0
def job():
    count = 0
    while count < 50:
        women = matches()
        women = women['results']

        for w in women:
            tinder.like(w['_id'])
            print('liked')
            count += 1
            api.pause()

    nap_length = 3 * random.random()
    time.sleep(nap_length)
예제 #4
0
파일: bot.py 프로젝트: psilogroup/TinderBot
def likeAPerson():
    time.sleep(5)
    for key, value in api.get_recommendations().items():
        match = []
        if (key == "results"):
            for person in value:
                rating = 0
                person_id = ""
                name = ""
                for key, value in person.items():
                    if (key == "_id"):
                        person_id = value
                        time.sleep(5)
                    if key == 'photos' and value:
                        if len(value) >= 2:
                            rating += 1
                    if key == 'name':
                        name = value

                if rating > 0:
                    print("Like on : ", name)
                    match = api.like(person_id)
                    likes_remaining = match["likes_remaining"]
                    if likes_remaining == 0:
                        print("Acabaram os likes, terminei por hoje")
                        quit(0)
                    print(match)
                else:
                    print("Unlike: ", name)
예제 #5
0
    def swipe_right(self):
        LIKES_LIMIT = 45  #Tinder has a limit of 100 like per 12 hours, like 45/6 hours so we are safe.
        try:
            track_iterator = 0
            while track_iterator <= LIKES_LIMIT:
                recommendations = tinder_api.get_recs_v2()['data']['results']
                for rec in recommendations:
                    girl_id = rec['user']['_id']
                    try:
                        like_response = tinder_api.like(girl_id)
                    except:
                        print('WHATS HAPPENING')
                        return
                    print('LIKED')
                    self.statistics['swipes'] += 1
                    track_iterator += 1
                    if track_iterator == LIKES_LIMIT:  # Check if its time to stop liking
                        self.last_like_at = datetime.now()
                        self.fix_time_file()
                        self.update_statistics_file()
                        break

                    time.sleep(10)
            print('DONE LIKING')
        except:
            print('COULD NOT FINISH LIKING')
예제 #6
0
 def like_person(self):
     if not self.logged_in:
         self.feedback_append_line("Please login first!")
         return
     self.feedback_append_line("Liking: " + self.id)
     resp = tinder_api.like(self.id)
     if resp["match"]:
         self.feedback_append_line("It seems like she likes you to! <3")
     else:
         self.feedback_append_line("No match ... yet!")
예제 #7
0
def swipe_right(n):
    recs = api.get_recs_v2()["data"]["results"]

    bound = min(len(recs), n)
    for i in range(bound):
        rec = recs[i]
        result = api.like(rec["user"]["_id"])
        dumps(result, "Swipe right...")
        if i < bound - 1:
            pause(.5, 3)
예제 #8
0
    prop_nopes = 100.0 - prop_likes
    print('likes = {} ({}%), nopes = {} ({}%)'.format(likes, prop_likes, nopes,
                                                      prop_nopes))


if __name__ == "__main__":
    like_ids, dislike_ids = [], []
    tinderlogin(config.username, config.password)
    ti.change_preferences(age_filter_min=AGE_MIN,
                          age_filter_max=AGE_MAX,
                          distance_filter=DISTANCE)
    rate_limited = 0
    while True:
        rec = ti.get_recs_v2()["data"]["results"]
        for user in rec:
            id_ = user["user"]["_id"]
            url = user["user"]['photos'][0]["processedFiles"][0]["url"]
            try:
                if like_or_nope(url) == 1:
                    ti.like(id_)
                    like_ids.append(id_)
                else:
                    ti.dislike(id_)
                    dislike_ids.append(id_)
            except:
                rate_limited = 1
        if rate_limited == 1:
            print('Limit reached.')
            break
    print(stats(len(like_ids), len(dislike_ids)))
예제 #9
0
        for match in matches:
            try:
                match_id = matches[i]['match_id']
                offer_id = 1
                text = select_msg(match_id,offer_id)
                api.send_msg(match_id, text)
            except:
                continue
        rec = api.get_recommendations()
        i = 0
        for user in rec:
            try:
                if i%3=0:
                    api.dislike(user["person_id"])
                else:
                    api.like(user["person_id"])
                i ++
            except:
                continue
    except:
        break



# matchthread.join()

# Upon starting the program i should start a separate thread that basically begins get_matches
# so that all the data is stored locally after about a minute but behind the scenes.


# It is probably a good idea to
예제 #10
0
                                      str(person_id) + '_' +
                                      str(photo_no) + '_' +
                                      str(i) + '.jpg')
                 img = image.img_to_array(img)
                 # Apply the neural network to predict face beauty.
                 temp = img.reshape((1, ) + img.shape)
                 pred = FBP_model.predict(
                     img.reshape((1, ) + img.shape))
                 print(pred)
                 ratings.append(pred[0][0])
                 i += 1
             photo_no += 1
 max_rating = max(ratings)
 # If the maximal rating received for a profile's photo is greater than 3, like the profile.
 if max_rating >= inputs.args.rating:
     liker = api.like(person_id, headers)
     print('\x1b[1;32;40m' + "LIKE!!" + '\x1b[0m')
     if liker["match"]:
         print('\x1b[6;30;42m' + "!! NEW MATCH !!" + '\x1b[0m')
     liked_people += 1
     if T_profile['like'] <= 0 and liker["likes_remaining"] > 0:
         T_profile['like'] = 50
     T_profile['like'] -= 1
     liked = True
 print("All: " + str(all_poeple) + " | Liked: " +
       str(liked_people) + " | Likes remaining: " +
       str(T_profile['like']))
 F = open('log.txt', 'a')
 F.write(
     str(name) + ', ' + str(person_id) + ', ' +
     str(max_rating) + ', ' + str(liked) + "\n")
예제 #11
0
                print("Moving to {0}".format(location["label"]))
                tinder_api.update_location(location["lat"], location["lon"])
                location["visited"] = True
                EXISTS = 5
                CURRENT_LOCATION = location["label"]
                break
    r = tinder_api.get_recommendations()
    try:
        recommendations = r["results"]
    except KeyError as e:
        print(r)
        raise e
    print("Fetching {0} recommendations".format(len(recommendations)))
    for recommendation in recommendations:
        recommendation["t_id"] = recommendation.pop("_id")
        try:
            Human.objects.get(t_id=recommendation["t_id"])
        except Human.DoesNotExist:
            try:
                human = Human(**recommendation)
            except Exception as e:
                raise e
            human.label = CURRENT_LOCATION
            human.save()
            tinder_api.like(human.t_id)
            print("Like {0}".format(human.name))
            print("Sleeping {0} seconds...".format(LIKE_SLEEP_TIME))
            time.sleep(LIKE_SLEEP_TIME)
        else:
            EXISTS -= 1
예제 #12
0
def _like(person_id):
    res = api.like(person_id)
    if 'likes_remaining' not in res:
        res = api.like(person_id)
    return res['likes_remaining']
예제 #13
0
def like(userId):
    tinder_api.like(userId)
예제 #14
0
                    exit(0)

                if not os.path.exists(directory):
                    os.makedirs(directory)

                url = urls['url']
                filename_path = directory + str(count_photos) + ".png"
                count_photos += 1
                print(url, "=>", filename_path)
                wget.download(url, out=filename_path, bar=None)
                filename_paths.append(filename_path)
            try:
                action = model.like_or_nope(filename_paths,
                                            model_api_host=model_api_host,
                                            model_id=model_id)
                if action == 'like':
                    like_count += 1
                    print(' -> Like')
                    stats(like_count, nope_count)
                    match = ti.like(user.user_id)
                    if match:
                        print(' -> Match!')
                else:
                    nope_count += 1
                    print(' -> nope')
                    stats(like_count, nope_count)
                    ti.nope(user.user_id)

            except Exception as e:
                print(e)
예제 #15
0
    if person.get('schools'):
        for school in person['schools']:
            print('SCHOOL: ' + school['name'])

    if person.get('bio'):
        print('BIO: ' + person['bio'])

    if person.get('distance_mi'):
        print('DISTANCE: ' + str(person['distance_mi']) + ' miles')

    for photo in person['photos']:
        URL = photo['url']
        with urlopen(URL) as url:
            with open('temp.jpg', 'wb') as f:
                f.write(url.read())

        img = Image.open('temp.jpg')
        img.show()

    if dec:
        like(rec)
        print(bcolors.OKGREEN + 'LIKED' + bcolors.ENDC)
    else:
        dislike(rec)
        print(bcolors.FAIL + 'DISLIKED' + bcolors.ENDC)

    for _ in range(5):
        sleep(4 * random())
        print('...')
예제 #16
0
def main():
    credentials = json.load(open('credentials.json', 'r'))
    fb_id = credentials['FB_ID']
    fb_auth_token = get_access_token(credentials['FB_EMAIL_ADDRESS'],
                                     credentials['FB_PASSWORD'])
    model_api_host = str(credentials['API_HOST'])
    model_id = str(credentials['MODEL_ID'])

    print('Deep Learning Tinder bot')
    print('----------')
    print('FB_ID = {}'.format(fb_id))
    print('FB_AUTH_TOKEN = {}'.format(fb_auth_token))
    print('MODEL_API_HOST = {}'.format(model_api_host))
    print('MODEL_ID = {}'.format(model_id))

    like_count = 0
    nope_count = 0

    while True:
        token = ti.auth_token(fb_auth_token, fb_id)

        print('TINDER_TOKEN = {}'.format(token))

        if not token:
            print('could not get Tinder token. Program will exit.')
            sys.exit(0)

        print('Successfully connected to Tinder servers.')

        lat = 34.7
        lon = 135.5
        # http://words.alx.red/tinder-api-2-profile-and-geolocation/
        print(ti.change_loc(lat, lon, token))
        my_profile = ti.profile(token)
        print(json.dumps(my_profile, indent=4, sort_keys=True))

        for user in ti.recommendations(token):
            if not user:
                break

            count_photos = 1
            filename_paths = []
            for urls in user.d['photos']:
                directory = "data/" + str(user.age) + "/" + str(
                    user.user_id) + "/"

                if 'tinder_rate_limited_id' in directory:
                    print('Limit reached.')
                    exit(0)

                if not os.path.exists(directory):
                    os.makedirs(directory)

                url = urls['url']
                filename_path = directory + str(count_photos) + ".png"
                count_photos += 1
                print(url, "=>", filename_path)
                wget.download(url, out=filename_path, bar=None)
                filename_paths.append(filename_path)
            try:
                action = model.like_or_nope(filename_paths,
                                            model_api_host=model_api_host,
                                            model_id=model_id)
                if action == 'like':
                    like_count += 1
                    print(' -> Like')
                    stats(like_count, nope_count)
                    match = ti.like(user.user_id)
                    if match:
                        print(' -> Match!')
                else:
                    nope_count += 1
                    print(' -> nope')
                    stats(like_count, nope_count)
                    ti.nope(user.user_id)

            except Exception as e:
                print(e)
예제 #17
0
def press(event):
    global _id
    global images
    global like
    global dislike
    global txt
    global fig
    sys.stdout.flush()
    print('you pressed {}'.format(event.key))
    if event.key == 'e':
        print('exit')
        sys.exit()
        raise SystemExit()

    if event.key in ['right', 'left', 'up']:
        if event.key == 'right':
            # Like a user
            tinder_api.like(_id)
            print('you liked')
            text = 'LIKED'
            count = 0
            for _image in images:
                io.imsave(
                    '/home/majid/Ternow-Lovai/data/liked/profile_{}_{}.jpg'.
                    format(_id, count), _image)
                count += 1
                like += 1
                #break
        elif event.key == 'left':
            # Dislike a user
            tinder_api.dislike(_id)
            print('you disliked')
            text = 'DISLIKED'
            count = 0
            for _image in images:
                io.imsave(
                    '/home/majid/Ternow-Lovai/data/disliked/profile_{}_{}.jpg'.
                    format(_id, count), _image)
                count += 1
                dislike += 1
                #break
        elif event.key == 'top':
            # Superlike a user
            tinder_api.superlike(_id)
            print('you superliked')
            text = 'SUPERLIKED'
            count = 0
            for _image in images:
                io.imsave(
                    '/home/majid/Ternow-Lovai/data/liked/profile_{}_{}.jpg'.
                    format(_id, count), _image)
                count += 1
                like += 1
                #break

        #plt.text(5, 5, text, style='italic', bbox={'facecolor':'red', 'alpha':0.5, 'pad':10})
        if text in ['LIKED', 'SUPERLIKED']:
            txt = plt.text(.5,
                           .5,
                           text,
                           fontsize=30,
                           style='italic',
                           bbox={
                               'facecolor': 'green',
                               'alpha': 0.5,
                               'pad': 1
                           })
        elif text == 'DISLIKED':
            txt = plt.text(.5,
                           .5,
                           text,
                           fontsize=30,
                           style='italic',
                           bbox={
                               'facecolor': 'red',
                               'alpha': 0.5,
                               'pad': 1
                           })

        fig.canvas.draw()
        time.sleep(1)
        #plt.show(block=False)
        plt.close('all')
예제 #18
0
                    exit(0)

                if not os.path.exists(directory):
                    os.makedirs(directory)

                url = urls['url']
                filename_path = directory + str(count_photos) + ".png"
                count_photos += 1
                print(url, "=>", filename_path)
                wget.download(url, out=filename_path, bar=None)
                filename_paths.append(filename_path)
            try:
                action = model.like_or_nope(filename_paths,
                                            model_api_host=model_api_host,
                                            model_id=model_id)
                if action == 'like':
                    like_count += 1
                    print(' -> Like')
                    stats(like_count, nope_count)
                    match = ti.like(user.user_id)
                    if match:
                        print(' -> Match!')
                else:
                    nope_count += 1
                    print(' -> nope')
                    stats(like_count, nope_count)
                    ti.nope(user.user_id)

            except Exception as e:
                print(e)