Scraping and identifying faces on Twitter with Python #FaceApp

There’s been a lot of very worried people tweeting about FaceApp after a story broke that it is ‘uploading all of your photos’ to Russians. Despite the story shrinking, realising that their terms are no different from any other app and they’re not actually uploading photos there are still some very worried tweets like this:

This seems to be the common worry. That your face being out there, means it can be hoovered up and fed into ‘the neural net’.

There is apparently no irony to people saying this from their Twitter account which has a picture of their face and their usually their name.

Detecting and saving faces and names from Twitter

Source code: https://github.com/thetafferboy/faceoff

Here’s some very messy Python from an amateur coder, showing just how easy it is to achieve this. I used Tweepy library to access and search Twitter and then the OpenCV library for facial recognition following a great tutorial from RealPython.

The script does this:

  1. Performs a Twitter search for a random common word from a list
  2. Grabs the first 10 (or however many you like) tweets as results
  3. Pulls the username and downloads profile photo of the person tweeting
  4. Runs the profile photo through facial detection to see if the image contains a face
  5. Voila: You have named photos that contain faces

tl;dr Don’t worry about some viral app stealing your face, anyone could harvest millions of names and faces without permission anyway and you’re probably already more fucked than you realise 🙂