Skip to content

Instantly share code, notes, and snippets.

@yesezra
Last active December 10, 2015 01:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yesezra/4356638 to your computer and use it in GitHub Desktop.
Save yesezra/4356638 to your computer and use it in GitHub Desktop.
Printing Facebook mugshots for a party.

Using the Facebook Graph Explorer, perform this query. Make sure you have permissions to access users' photos. {event-id}/invited?fields=picture

Grab the JSON that results, and copy/past the array under the "data" attribute to attendees.json

In Ruby,

require 'json'

filename = 'attendees.json'
json_string = File.open(filename, 'rb') { |f| f.read }
attendees = JSON.parse(json_string)
attendees.select { |i| i["rsvp_status"] == "attending" }
         .map {|i| i["picture"]["data"]["url"]}
         .map {|url| url.gsub("_q","_n")}
         .each {|url| `curl -O #{url}`}

Then use iPhoto or similar to print out contact sheets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment