예제 #1
0
def get_match_info():
	matches = api.get_updates()['matches']
	name_dict = {}
	for match in matches[:len(matches) - 2]:
		try:
			PERSON = match['person']
			name = PERSON['name']
			person_id = PERSON['_id'] # for looking up profile
			match_id = match['id'] # for sending messages
			person_json = api.get_person(person_id)
			ping_time = PERSON['ping_time']
			message_count = match['message_count']
			photos = get_photos_by_person_id(person_json)
			bio = PERSON['bio']
			gender = PERSON['gender']
			distance = person_json['results']['distance_mi']
			name_dict[person_id] = {
			"name": name,
			"ping_time": ping_time,
			"match_id": match_id,
			"message_count": message_count,
			"photos": photos,
			"bio": bio,
			"gender": gender,
			"distance": distance
			}
		except:
			continue
	return name_dict
예제 #2
0
def get_match_info():
    matches = api.get_updates()['matches']
    now = datetime.utcnow()
    match_info = {}
    for match in matches[:len(matches)]:
        try:
            person = match['person']
            person_id = person['_id']  # This ID for looking up person
            match_info[person_id] = {
                "name": person['name'],
                "match_id": match['id'],  # This ID for messaging
                "message_count": match['message_count'],
                "photos": get_photos(person),
                "bio": person['bio'],
                "gender": person['gender'],
                "avg_successRate": get_avg_successRate(person),
                "messages": match['messages'],
                "age": calculate_age(match['person']['birth_date']),
                "distance":
                api.get_person(person_id)['results']['distance_mi'],
                "last_activity_date": match['last_activity_date'],
            }
        except Exception as ex:
            template = "An exception of type {0} occurred. Arguments:\n{1!r}"
            message = template.format(type(ex).__name__, ex.args)
            print(message)
            # continue
    print("All data stored in variable: match_info")
    return match_info
예제 #3
0
    def view_person(self, id):
        if not self.logged_in:
            self.feedback_append_line("Please login first!")
            return
        self.id = id
        self.feedback_append_line("** Viewing: " + str(id))
        person = tinder_api.get_person(id)["results"]

        pics = person["photos"]

        pic_urls = []

        for pic in range(len(pics)):
            pic_urls.append(pics[pic]["processedFiles"][1]["url"])

        layout = QGridLayout()
        for number, pic in enumerate(pic_urls):
            layout.addWidget(Picture(pic, 275), number / 2, number % 2)
        self.view_scroll.setLayout(layout)

        widget = QWidget()
        widget.setLayout(layout)

        self.view_scroll.setWidget(widget)
        name = person["name"]
        bio = "no bio"
        birthday = "no birthday"
        ping = "no ping"
        city = "no city"
        dist = "no distance"

        if "bio" in person:
            bio = person["bio"]

        if "birth_date" in person:
            birthday = person["birth_date"]

        if "ping_time" in person:
            ping = person["ping_time"]

        if "city" in person:
            city = person["city"]["name"] + " -- " + person["city"]["region"]

        if "distance_mi" in person:
            dist = person["distance_mi"]

        self.name_label.setText(name)
        self.bio_label.setText("bio: " + bio)
        self.distance_label.setText("distance (mi): " + str(dist))
        self.bday_label.setText("fuzzy birthday: " + birthday)
        self.ping_label.setText("ping: " + ping)
        self.city_label.setText("city: " + city)
예제 #4
0
파일: run.py 프로젝트: jawandsingh/Tinder
def get_match_info():
    matches = api.get_updates()['matches']
    now = datetime.utcnow()
    match_info = {}
    for match in matches[:len(matches) - 2]:
        try:

            person = match['person']
            name = person['name']
            person_id = person['_id']  # for looking up profile
            match_id = match['id']  # for sending messages
            message_count = match['message_count']
            photos = get_photos(person)
            # bio = person['bio']
            gender = person['gender']
            messages = match['messages']
            birthday = match['person']['birth_date']
            avg_successRate = get_avg_successRate(person)
            last_activity_date = match['last_activity_date']
            # Takes too long...
            distance = api.get_person(person_id)['results']['distance_mi']

            match_info[person_id] = {
                "name": name,
                "match_id": match_id,
                "message_count": message_count,
                "photos": photos,
                # "bio": bio,
                "gender": gender,
                "avg_successRate": avg_successRate,
                "messages": messages,
                "age": calculate_age(birthday),
                "distance": distance,
                "last_activity_date": last_activity_date,
                # "readable_activity_date": get_last_activity_date(now, last_activity_date)
            }

        except Exception as ex:
            template = "An exception of type {0} occurred. Arguments:\n{1!r}"
            message = template.format(type(ex).__name__, ex.args)
            print(message)
    print("All data stored in: match_info")
    return match_info
예제 #5
0
        rec = ti.get_recs_v2()["data"]["results"]
        for user in rec:
            id_ = user["user"]["_id"]
            if 'tinder_rate_limited_id' in str(user):
                print('Limit reached.')
                rate_limited = 1
                break
            url = user["user"]['photos'][0]["processedFiles"][0]["url"]
            if like_or_nope(url) == 1:
                ti.like(id_)
                like_ids.append(id_)
            else:
                ti.dislike(id_)
                dislike_ids.append(id_)
        if rate_limited == 1:
            break

    for i in like_ids:
        user = ti.get_person(i)["results"]
        id_ = user["_id"]
        url = user['photos'][0]["processedFiles"][0]["url"]
        saveLog("like", url, id_)

    for id_ in dislike_ids:
        user = ti.get_person(i)["results"]
        id_ = user["_id"]
        url = user['photos'][0]["processedFiles"][0]["url"]
        saveLog("dislike", url, id_)

    print(stats(len(like_ids), len(dislike_ids)))
예제 #6
0
 if os.stat("countFile.txt").st_size == 0:
     count = 0
 else:
     count = int(f.readline()) + 1
 f = open("countFile.txt", "w+")
 myLoves = open("myLoves.txt", "a")
 tinder_api.fb_access_token = fb_auth.get_fb_access_token(
     fb_username, fb_password)
 tinder_api.fb_user_id = fb_auth.get_fb_id(tinder_api.fb_access_token)
 tinder_api.authverif()
 didIFindMyLove = False
 totalFound = 0
 totalFoundInfo = ''
 try:
     while didIFindMyLove == False:
         person = tinder_api.get_person(count)
         distance_km = 0
         if 'gender' in person:
             try:
                 distance_mi = float(person['distance_mi'])
             except:
                 distance_mi = 0
             distance_km = float(distance_mi) * 1.609344
             if int(person['gender']) == 1 and int(distance_km) < 100:
                 detail = "ID: " + str(count) + " Img: " + str(
                     person['photos'][0]['url']) + " Distance: " + str(
                         distance_km) + " km"
                 totalFound += 1
                 myLoves.writelines(detail + ' \n')
                 totalFoundInfo = " Total Found: " + str(
                     totalFound) + " Detail: " + detail
예제 #7
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"):
                        photo_no = 0
                        # Loop of photos of a profile.
                        for photo in value:
                            processedFiles = photo['processedFiles']
                            temp = processedFiles[0]
                            url = (temp['url'])
                            # Retrieve url of photo.
                            urllib.request.urlretrieve(
                                url, 'Tinder photos/' + str(person_id) + '_' +
                                str(photo_no) + '.jpg')
                            im = cv2.imread('Tinder photos/' + str(person_id) +
                                            '_' + str(photo_no) + '.jpg')
예제 #8
0
파일: test.py 프로젝트: ultralytics/tinder
            img_name = txt_file[:-4].split('/')[-1]
            box = labels[0].astype('int')
            h, w = box[3] - box[1], box[2] - box[0]
            area = w * h

            if (w > 150) and (h > 150) and (area > 30e3):
                img = cv2.imread(match_dir + img_name)
                cv2.imwrite(crop_dir + img_name, img[box[1]:box[3],
                                                     box[0]:box[2]])

exit()

# Get Tinder Recommendations of people around you
# recommendations = tinder_api.get_recommendations()
recommendations = tinder_api.get_recs_v2()

# select one recommended individual
testid = recommendations['data']['results'][0]['user']['_id']
print(testid)

# Retrieve profile from id
testperson = tinder_api.get_person(testid)
testperson

# Like a user
# tinder_api.like('5a10ae3c8802dc4401463712')

# message a match
tinder_api.send_msg('59ff7c30117d37c0572338d55a10ae3c8802dc4401463712',
                    'Hi, boy! Gloria Tinder-Robot here')
예제 #9
0
        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))

    #Match a decision to a recommendation
    rec = recommendations.get()
    dec = decisions.get()

    print('ID: ' + rec)
    person = get_person(rec)
    person = person['results']
    print('NAME: ' + person['name'])
    if person.get('jobs'):
        for job in person['jobs']:
            if job.get('company'):
                print('COMPANY: ' + job['company']['name'])
            if job.get('title'):
                print('TITLE: ' + job['title']['name'])

    if person.get('schools'):
        for school in person['schools']:
            print('SCHOOL: ' + school['name'])

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