MCPcopy
hub / github.com/Greenwolf/social_mapper / fill_twitter

Function fill_twitter

social_mapper.py:325–406  ·  view source on GitHub ↗
(peoplelist)

Source from the content-addressed store, hash-verified

323
324
325def fill_twitter(peoplelist):
326 TwitterfinderObject = twitterfinder.Twitterfinder(showbrowser)
327 TwitterfinderObject.doLogin(twitter_username, twitter_password)
328 if args.waitafterlogin:
329 input("Press Enter to continue after verifying you are logged in...")
330
331 count = 1
332 ammount = len(peoplelist)
333 for person in peoplelist:
334 if args.vv == True or args.debug == True:
335 print("Twitter Check %i/%i : %s" % (count, ammount, person.full_name))
336 else:
337 sys.stdout.write(
338 "\rTwitter Check %i/%i : %s " % (count, ammount, person.full_name))
339 sys.stdout.flush()
340 count = count + 1
341 if person.person_image:
342 try:
343 target_image = face_recognition.load_image_file(person.person_image)
344 target_encoding = face_recognition.face_encodings(target_image)[0]
345 profilelist = TwitterfinderObject.getTwitterProfiles(person.first_name, person.last_name)
346 if args.debug == True:
347 print(profilelist)
348 except:
349 continue
350 else:
351 continue
352
353 early_break = False
354 updatedlist = []
355 for profilelink, profilepic, distance in profilelist:
356 try:
357 os.remove("potential_target_image.jpg")
358 except:
359 pass
360 if early_break:
361 break
362 image_link = profilepic
363 if image_link:
364 try:
365 urllib.request.urlretrieve(image_link, "potential_target_image.jpg")
366 potential_target_image = face_recognition.load_image_file("potential_target_image.jpg")
367 try: # try block for when an image has no faces
368 potential_target_encoding = face_recognition.face_encodings(potential_target_image)[0]
369 except:
370 continue
371 results = face_recognition.face_distance([target_encoding], potential_target_encoding)
372 for result in results:
373 if args.mode == "fast":
374 if result < threshold:
375 person.twitter = encoding.smart_str(profilelink, encoding='ascii', errors='ignore')
376 person.twitterimage = encoding.smart_str(image_link, encoding='ascii', errors='ignore')
377 if args.vv == True:
378 print("\tMatch found: " + person.full_name)
379 print("\tTwitter: " + person.twitter)
380 early_break = True
381 break
382 elif args.mode == "accurate":

Callers 1

social_mapper.pyFile · 0.85

Calls 3

doLoginMethod · 0.95
getTwitterProfilesMethod · 0.95
killMethod · 0.95

Tested by

no test coverage detected