Пример #1
0
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)
Пример #2
0
def matches():
    if tinder.authverif() == True:
        matches = tinder.get_recommendations()
        return matches
    else:
        print('Sorry, something went wrong')
        return None
Пример #3
0
def start_session():
    api.authverif()

    likes_remaining = True
    num_likes = 0
    num_dislikes = 0

    while likes_remaining:
        # Retrieve recommended profiles from Tinder.
        for person in api.get_recommendations()['results']:
            person_id = person['_id']
            rating = rater.get_rating(person)

            if hot_or_not(rating):
                if not _like(person_id):
                    likes_remaining = False
                    break
                num_likes += 1
            else:
                _dislike(person_id)
                num_dislikes += 1

            print(f"Swiping: {num_likes} likes, {num_dislikes} dislikes",
                  end='\r')

    now = datetime.now()
    print(
        f"{now.strftime('%H:%M : %d/%m/%Y')} Session complete: {num_likes} likes, {num_dislikes} dislikes"
    )
Пример #4
0
def recommend():
    if not tinder_api.authverif():
        login()
    recommendations = tinder_api.get_recommendations(
    )  # output json {status='', results=[profile]}
    # print(recommendations['results']) # get list of profiles
    # print(recommendations['results'][0])
    return render_template('recommend.html')
Пример #5
0
def recGen(ageMin=18, ageMax=22, distance=100):
    ti.change_preferences(age_filter_min=ageMin,
                          age_filter_max=ageMax,
                          distance_filter=distance)
    recommendations = ti.get_recommendations()
    df = pd.DataFrame.from_dict(recommendations["results"])
    df = df[['_id', 'name', 'gender', 'birth_date', 'bio', 'photos']]
    df = df.rename(index=str, columns={'_id': 'ID', 'birth_date': 'dob'})

    imgurls = []
    for i in df['photos']:
        imgurls.append(i[0]['processedFiles'][0]['url'])

    df = df.drop(['photos'], axis=1)
    df['imgurl'] = pd.Series(imgurls).values
    df["dob"] = df["dob"].apply(lambda x: calculate_age(x))
    df = df.rename(index=str, columns={"dob": "age"})
    return df
Пример #6
0
if __name__ == '__main__':
    if api.authverif() == True:
        print("Gathering Data...")
        #match_info = get_match_info()
        targetAmount = 500
        currentAmount = 0
        cycle = 0
        start_time = time.time()
        while currentAmount < targetAmount:
            if cycle > 0:
                pause()
            cycle += 1
            progress = round((currentAmount / targetAmount) * 100, 2)
            print(str(progress) + "% Running cycle #" + str(cycle) + "...")
            people = api.get_recommendations()
            n = findPeople(people)
            currentAmount += n
            if n == 0:
                choice = input(
                    "Didn't receive any new records. Wanna continue?")
                if not choice == 'y':
                    print("Aborting.")
                    break
        print("Job completed in " + str(cycle) + " cycles, " +
              str(datetime.timedelta(seconds=(time.time() - start_time))) +
              ". Added a total of " + str(currentAmount) +
              " people to the datafile.")
    else:
        print("Something went wrong. You were not authorized.")
Пример #7
0
 loop += 1
 print(loop)
 if EXISTS <= 0:
     if all([location["visited"] for location in LOCATIONS]):
         print("un-visiting locations...")
         for location in LOCATIONS:
             location["visited"] = False
     for location in LOCATIONS:
         if not location["visited"]:
             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
Пример #8
0
            sub_img, int(np.floor((side - sub_img.shape[1]) / 2)),
            int(np.ceil((side - sub_img.shape[1]) / 2)),
            int(np.floor((side - sub_img.shape[0]) / 2)),
            int(np.ceil((side - sub_img.shape[0]) / 2)), cv2.BORDER_CONSTANT)
        sub_image_resized = cv2.resize(src=sub_image_padded, dsize=(350, 350))
        processed_images.append(sub_image_resized)
    return processed_images


# Get recommendations, analyze and swipe them.
person_id = ''
liked_people = 0
all_poeple = 0
for request_ix in range(num_requests):
    # Retrieve recommended profiles from Tinder.
    for key, value in api.get_recommendations(headers).items():
        if (key == "results"):
            # Loop over profiles.
            for person in value:
                print("---------------------------------------")
                all_poeple += 1
                liked = False
                ratings = [0]
                for key, value in person.items():
                    if (key == "_id"):
                        person_id = value
                        print('Person id: ', person_id)
                        person_data = api.get_person(person_id, headers)
                        name = person_data["results"]["name"]
                        print("Name: " + name)
                    if (key == "photos"):
Пример #9
0
get_my_locations('locations.csv') # получаем 3 случайных локации из файла и записываем в список my_locations
for location in my_locations:
    try:
        lat = location.split(":")[0]
        lon = location.split(":")[1]
        api.get_ping(lat,lon)
        matches = get_match_info()
        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


Пример #10
0
def gettoken_id(fb_username, fb_password):

    fb_username = '******'
    fb_password = '******'

    global _id
    global fig

    host = 'https://api.gotinder.com'

    fb_access_token = fb_auth_token.get_fb_access_token(
        fb_username, fb_password)
    fb_user_id = fb_auth_token.get_fb_id(fb_access_token)

    tinder_api.get_auth_token(fb_access_token, fb_user_id, host)
    print("#################################################")

    while (like < 30 or dislike < 30):

        try:
            recommendations = tinder_api.get_recommendations()

        except:
            recommendations = tinder_api.get_recommendations()

        for index in range(len(recommendations['results'])):
            global images
            images = []

            name = recommendations['results'][index]['name']
            birth_date = features.calculate_age(
                recommendations['results'][index]['birth_date'])
            ping_time = recommendations['results'][index]['ping_time']
            if name == '5 GUM':
                continue

        _id = recommendations['results'][index]['_id']

        print("name is {} and is {} years old  and bio is {}".format(
            name, birth_date, recommendations['results'][index]['bio']))

        try:
            if recommendations['results'][index]['bio']:
                fig = plt.figure('Biography', figsize=(6, 4))
                t = (recommendations['results'][index]['bio'])
                text = fig.text(0.5, 0.5, t, ha='center', va='center', size=10)
                text.set_path_effects([path_effects.Normal()])
                plt.axis('off')
                plt.tight_layout()
                plt.show(block=False)
        except:
            plt.close()
            pass

        number_of_subplots = len(recommendations['results'][index]['photos'])
        if number_of_subplots < 1:
            continue
        elif number_of_subplots == 1:
            fig, axes = plt.subplots(figsize=(15, 15))
        elif number_of_subplots <= 4:
            fig, axes = plt.subplots(1, number_of_subplots, figsize=(15, 15))
        elif number_of_subplots > 4:
            fig, axes = plt.subplots(int(number_of_subplots / 4) + 1,
                                     4,
                                     figsize=(15, 15))
        fig.canvas.mpl_connect('key_press_event', press)
        subplots_adjust(hspace=0.000)

        for i, v in enumerate(range(number_of_subplots)):
            p = recommendations['results'][index]['photos'][i]
            image = io.imread(p['url'])
            images.append(image)

            if number_of_subplots == 1:
                axes.axis('off')
                axes.imshow(image)
                axes.axis('off')
            elif number_of_subplots <= 4:
                axes[i].axis('off')
                axes[i].imshow(image)
                axes[i].axis('off')
            else:
                axes[int(i / 4), int(i % 4)].axis('off')
                axes[int(i / 4), int(i % 4)].imshow(image)
                axes[int(i / 4), int(i % 4)].axis('off')

        if number_of_subplots == 5:
            for j in range(4):
                axes[int(i / 4), int(j)].axis('off')

        elif number_of_subplots > 5:
            while i % 4 != 0:
                axes[int(i / 4), int(i % 4)].axis('off')
                i += 1

        plt.tight_layout()
        #plt.axis('off')
        plt.show(block=True)

        print("###################################")
Пример #11
0
 def get_recs(self):
     return tinder_api.get_recommendations(self.auth_token)
Пример #12
0
for circuit in circuits:
    q = Q_program.get_quantum_register("q")
    c = Q_program.get_classical_register('c')
    decision_circuit = Q_program.create_circuit(circuit, [q], [c])
    decision_circuit.h(q[0])  #Turn the qubit into |0> + |1>
    decision_circuit.measure(q[0], c[0])
_ = Q_program.get_qasms(circuits)  # Suppress the output

###Main Loop###
recommendations = Queue()  #Queue to hold tinder recommendations
decisions = Queue()  #Queue to hold QX decisions

while True:
    #Replenish the queues
    if recommendations.empty():
        results = get_recommendations()
        results = results['results']
        for key in results:
            recommendations.put(key['_id'])

    if decisions.empty():
        results = Q_program.execute(circuits,
                                    device,
                                    shots=1,
                                    max_credits=5,
                                    wait=10,
                                    timeout=240)
        for ciruit in circuits:
            for key in results.get_counts(ciruit):
                decisions.put(int(key))