RUBY - Facebook API - Download Photo Albums

Closed - This job posting has been filled and work has been completed.
Web, Mobile & Software Dev Scripts & Utilities Posted 2 years ago

Hourly Job

As Needed
Less than 1 week

Details

I have a facebook app that get's the user's "user_photos" permission.

I need a simple script that will download all pictures from all photo albums of a facebook user.
Preferably you will use this gem: https://github.com/nov/fb_graph

The script will be run like this:
ruby fb_download.rb HERE_THE_CODE

As you can see, I will pass the authorization code to the script as ARGV[0].

I did some work myself, see below:


require "rubygems"
require "fb_graph"

APP_ID = "..."
APP_SECRET = "...."
CODE = ARGV[0].strip # this is what Facebook will return after the user installs the App.. this is no access token

# Get Access Token:
fb_auth = FbGraph::Auth.new(APP_ID, APP_SECRET)
client = fb_auth.client
client.redirect_uri = "..." # this must match 100% with the redirect_uri when the user installs the app

client.authorization_code = CODE
access_token = client.access_token! :client_auth_body

user = FbGraph::User.me(access_token)
user = user.fetch

# Download Albums
user.albums.each do |album|
  album.photos.each do |photo|
    # ???
  end
end


About the Client

(4.99) 30 reviews

United Arab Emirates
Dubai 08:55 AM

57 Jobs Posted
58% Hire Rate, 1 Open Job

Over $30,000 Total Spent
46 Hires, 0 Active

$49.62/hr Avg Hourly Rate Paid
639 Hours

Member Since Sep 26, 2011