felix_xiao
felix_xiao

Reputation: 1628

Facebook: Get Public Photos for User

I am trying to build a web app that pulls all public photos from any user's Facebook account given the profile URL and was wondering if this is possible. For example, on some accounts, I can go to a person's Facebook profile without being logged in and view a profile picture, some cover photos, etc.

I am writing this using React.js.

If I were given

this.props.urlOfFacebookUser

where the urlOfFacebookUser is facebook.com/urlOfFacebookUser

Could I somehow use this value to query their public photos?

Upvotes: 0

Views: 954

Answers (1)

Galen Cook
Galen Cook

Reputation: 124

You could do this in two ways, either with a scraper or an API.

In order to accomplish it in the way you are describing you'll need to use a web scraper (like Nokogiri). You could set it up to scrape the specific element you are attempting to access. To do this, open the developer console while on Facebook and figure out how to precisely target the image. (The Nokogiri site I've provided has tutorials on this.)

The other, and probably more legitimate, way of going about this is by connecting to the Facebook Graph API. The instructions on how to do this are here.

Getting the API set up might be daunting, but from my experience scrapers are often more trouble than they are worth.

Upvotes: 1

Related Questions