View facebook friend list [hidden or not hidden]

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
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 · 836 weeks and 1 day 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 · 836 weeks and 1 day 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 · 836 weeks and 1 day 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 · 836 weeks ago
@vlan7: Groxx is not signing as "Facebook", but rather addressing them in the same manner as "Thanks for the lynx command, vlan7."
dennisw · 836 weeks ago
oh! I misunderstood Groxx :$ sorry, I'm not native english.
vlan7 · 835 weeks and 6 days 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 · 835 weeks and 4 days ago
Is there a way to get only online friends?
RanyAlbeg · 834 weeks and 3 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 · 826 weeks and 6 days 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 · 820 weeks and 2 days ago
im a newbie how can i use this??
angel76 · 807 weeks and 4 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 · 802 weeks and 2 days 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: