lynx -useragent=Opera -dump 'http://www.facebook.com/ajax/typeahead_friends.php?u=4&__a=1' |gawk -F'\"t\":\"' -v RS='\",' 'RT{print $NF}' |grep -v '\"n\":\"' |cut -d, -f2

View facebook friend list [hidden or not hidden]

There's no need to be logged in facebook. I could do more JSON filtering but you get the idea... Replace u=4 (Mark Zuckerberg, Facebook creator) with desired uid. Hidden or not hidden... Scary, don't you?
Sample Output
(...)
Stephen Heise
"u":"http:\/\/www.facebook.com\/heise
Yvonne Chan
"u":"http:\/\/www.facebook.com\/profile.php?id=1572606235
David Ebersman
"u":"http:\/\/www.facebook.com\/ebersman
Jack Xu
"u":"http:\/\/www.facebook.com\/profile.php?id=100000155763568

21
By: vlan7
2010-01-29 15:10:35

2 Alternatives + Submit Alt

What Others Think

uhm.. this may sound stupid, but how do i get my (anyone elses) userid? all facebook displays is a username (e.g. in my case 'drazraeltod') that doesn't seem to work another question: why using lynx instead of wget or curl? did i miss something important?
DrAzraelTod · 433 weeks and 2 days ago
ah.. forget the last part of the question... i just found a friend without username and he has of course my id in his list :-)
DrAzraelTod · 433 weeks and 2 days ago
We could use wget / curl. No problem. It's our choice. But don't forget to specify the user-agent. Facebook only accepts well-known user-agents... i.e. if we use wget we should type this syntax: wget -O - --user-agent='Opera' (...) P.S. You could also find your uid just placing the mouse cursor on your profile avatar ;)
vlan7 · 433 weeks and 2 days ago
Only works if you have the "Public Search Results" checkbox checked, as it apparently makes all this info public. *unchecks box* didn't know it did that. It certainly doesn't imply it's making all that info public. Gee, thanks, Facebook.
Groxx · 433 weeks and 1 day ago
Dear Groxx, This must has been changed on facebook 1-2 days before today, because in my previous tests I checked it with my own uid (that always had "public search results" box unchecked) and it always have worked well. Today I try it one more time and this has changed :) Anyway, as you sign "Facebook" on your post, thanks to you and all Facebook team for changin' this and to not categorize nevermore the friend list as PAI (Public Information Available), as you name it in Facebook privacy terms ;) Oh, thanks for remove this: "when it is viewed by people who are logged in to Facebook. Keep in mind, however, that because Friend List is publicly available, it will be visible to people who are viewing your profile while not logged in." http://blog.facebook.com/blog.php?post=197943902130 Best regards,
vlan7 · 433 weeks and 1 day ago
Online tool to view anyone?s Facebook friends list (hidden or not) based on a user ID: http://mathiasbynens.be/examples/facebook-friends
mathias · 433 weeks and 1 day ago
@vlan7: Groxx is not signing as "Facebook", but rather addressing them in the same manner as "Thanks for the lynx command, vlan7."
dennisw · 433 weeks and 1 day ago
oh! I misunderstood Groxx :$ sorry, I'm not native english.
vlan7 · 433 weeks ago
This seems to not work with users who have pages using other locales, eg. ru-ru.facebook.com or es-la.facebook.com also, mathias, your online form has a bug, it always counts and shows Mark Zuckerberg's ID before listing the friends for the ID you choose.
monkeyvegas · 432 weeks and 5 days ago
Is there a way to get only online friends?
RanyAlbeg · 431 weeks and 4 days ago
When I try this, facebook refuses it because I'm using lynx and, as you said, they only accept well-known user-agents... But I specified Opera as indicated, so I don't see what could be going wrong. Any idea what I should do?
dcurl34hy · 424 weeks ago
I keep getting an error message when I try to run this. I am a total newbie and trying to learn here. I get "__a is not recognized as an internal etc.." What am I doing wrong?
RLCowboy · 417 weeks and 3 days ago
Try this: wget -O - --user-agent='Opera' 'http://www.facebook.com/ajax/typeahead_friends.php?u=7&__a=1' |gawk -F'\"t\":\"' -v RS='\",' 'RT{print $NF}' |grep -v '\"n\":\"' |cut -d, -f2 Regards,
vlan7 · 410 weeks and 2 days ago
im a newbie how can i use this??
angel76 · 404 weeks and 5 days ago
Vlan7, I keep getting the same mssage as RLCowboy along the lines of "__a is not recognized as an internal..."! I tried typing in just the facebook ajax typeahead address alone, but I only get something about 0 out of 0. Do you have a different command that works? Any other ways I could try your original command differently using wget? I really want this to work! Please help, Vlan7! Thank you!
toulseu · 399 weeks and 3 days ago
@DrAzraelTod: to get a number ID just try http://graph.facebook.com/USERNAME Now, most of fb users have a username and fb doesn't show their ID... And, regarding this link: is not showing hidden friends anymore :(
Ferdelanze · 343 weeks and 2 days ago
its possible READ THIS ARTICLES AND THE COMMENTS BELOW http://rahmankdkl.blogspot.com/2011_11_01_archive.html
rahmanp786 · 336 weeks ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: