In the footsteps of facematch.com

Published on . Takes less than 1 minute to read.

I get these crazy ideas sometimes...

I was impressed by the scene in The Social Network where Mr. Zuckerberg wrote a small program to download hundreds of (girl) pictures to make a site called facematch.com. I knew three things allready:

  1. I had seen a simple shell script to login to a webpage that I knew I could easily modify even through I had almost 0 experience with it.
  2. I knew our college website made the pictures readily available to logged in users
  3. I had about an hours worth of free time tonight.

An hour later I had this script and a folder with about 500 thumbnails.

itk-downloader.sh
#!/bin/bash
kasutajanimi=foobar # User
salasona=foobar # Pass
kaust="itk-pic" # Folder name
min_pic_id="440" # Min pic ID
max_pic_id="1000" # Max pic ID

wget --user-agent "ITK Notifier" --no-check-certificate --keep-session-cookies --save-cookies cookies.txt
--post-data="username=$kasutajanimi&pw=$salasona&Login=Logi sisse" https://itcollege.ois.ee/auth/login -O login
for i in `seq $min_pic_id $max_pic_id`;
do
    file="$kaust/$i.jpg"
    echo "Download $file"
    echo ""
    wget --user-agent "ITK Notifier" --no-check-certificate
    --load-cookies cookies.txt "https://itcollege.ois.ee/et/file/user-picture?user_id=$i" -O $file
done

rm -f login cookies.txt
echo "All done!"

View gist on GitHub

I didn't bother with any fancy config options or downloading every picture, this was ment as a proof of consept. Now all I need to do is write some PHP to make my very own facematch.com! (Naah, I've got better things to do.)

ProjectsITKfacematchMark ZuckerbergoisShell scriptSocial NetworkUser agent