Skip to content

Instantly share code, notes, and snippets.

@funkatron
Created July 18, 2012 21:12
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save funkatron/3138940 to your computer and use it in GitHub Desktop.
Save funkatron/3138940 to your computer and use it in GitHub Desktop.
here's how you get public FB data feeds
This only works with fully public profiles – try accessing the profile while logged-out of Facebook first.
Start with the username for a user. Let's try "thestrokes", from <https://www.facebook.com/thestrokes>
Note that you have to provide a user agent; it doesn't like curl's default. Also use -L to follow redirects.
curl -L -A 'Firefox' https://graph.facebook.com/thestrokes
gives us this:
{
"id": "167528651335",
"name": "The Strokes",
"picture": "http://profile.ak.fbcdn.net/hprofile-ak-ash2/373039_167528651335_1089499614_s.jpg",
"link": "https://www.facebook.com/thestrokes",
"likes": 2739917,
"cover": {
"cover_id": "10150631284076336",
"source": "http://sphotos-b.xx.fbcdn.net/hphotos-ash3/551697_10150631284076336_1014793644_n.jpg",
"offset_y": 46
},
"category": "Musician/band",
"is_published": true,
"website": "http://www.thestrokes.com",
"username": "thestrokes",
"genre": "Rock",
"band_members": "Jules - vocals\nFab - drums\nAlbert - guitar\nNick - guitar\nNikolai - bass ",
"record_label": "RCA Records/Rough Trade Records",
"talking_about_count": 18157
}
Use the id provided in a second call:
curl -L -A 'Firefox' https://facebook.com/feeds/page.php?id=167528651335&format=json
This gives us that page's public posts in JSON. Also try format=rss20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment