brianestey
brianestey

Reputation: 8302

How can I get only pictures from the facebook news feed using Graph API?

I'm looking at the Facebook Graph API and trying to pick out any pictures that a user has in their news feed.

I've found that if I use the API /me/feed I can get access to the entire feed. Each entry in the returned data array has a field called "type" which describes what kind of object it is. For example, I've seen the following:

"type": "status"
"type": "photo"
"type": "video"
etc...

Obviously I don't want the status, video or etc types and would like to filter out those results on the server but haven't figured out how. I was hoping it'd be something as simple as adding a query string like ?type=photo but that isn't the case.

Is there any way to filter the feed on the server side so I don't need to get down a lot of data for a few pictures?

Upvotes: 3

Views: 2377

Answers (2)

Anirudh Coontoor
Anirudh Coontoor

Reputation: 49

Facebook has added a filter parameter to the /me/home endpoint so if you query /me/home?filter=photos you get only photos from the users News Feed

Upvotes: 1

cpilko
cpilko

Reputation: 11852

It's easier to do in FQL than with the Graph API:

SELECT post_id, actor_id, message, attachment, place, created_time, likes, description
  FROM stream WHERE source_id = me() AND actor_id = me() 
   AND attachment.fb_object_type = 'photo'

Upvotes: 3

Related Questions