Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

I have a local text file containing Facebook ids, one per line, like this:

938751234570943
9875123457623
...
43639193242324

These ids actually are those of my Facebook friends interested in jazz.

Now I would like to create a "jazz" Facebook friends list ("Facebook friends lists" are Facebook feature) to easily invite them to jazz events.

How to create this Facebook friends list?

share|improve this question
    
You might want to approach it in another way...with ids, the only way that will work is an API method. Are you looking to quickly move friends to lists? –  phwd Jul 17 '11 at 14:21
    
My (non-facebook) address book has for each person: an optional facebook id, and a list of tags. The tags are more up-to-date that anything in my facebook. So I want to regularly create facebook friends lists based on those tags. When inviting people to a facebook event, this will allow me to more easily invite all people that have a certain tag. Maybe there is an application that does this? –  nic Jul 17 '11 at 15:03
add comment

3 Answers

Facebook API would probably be the most natural. However, if you have access to Linux you can at least extract the friends' names using wget as follows (see also wget for fetching Facebook profile/friend pages):

wget -U Mozilla --wait 1 "https://www.facebook.com/profile.php?id=938751234570943"

This will download the publicly available content and depending on privacy settings the name of the contact will appear and could be parsed.

share|improve this answer
    
Maybe my question is not clear enough, let me put it in other words: I already have the ids as local data. I need to push them back to Facebook in a way that Facebook will create what it calls a "friends list". –  nic Aug 17 '11 at 4:54
add comment

You can use the Facebook API to get the information you want and then add them to a database (or your definition of list).

In order to use that data, you need to query Facebook and although I'm not 100% sure, in order to do it, (even public data) you will need authorization from the user.

share|improve this answer
    
I should have been clearer: "friends list" are a Facebook thing, you can see them after clicking "Edit friends". I don't want to export anything FROM facebook, I want to import the list TO facebook. –  nic Jul 17 '11 at 13:34
add comment
up vote 0 down vote accepted

I ended up writing a bash script to compare Facebook and my address book.

Before running this script, I go to my Facebook friends list "jazz", and copy the generated HTML source into jazz.html.

When I run the script, it shows which jazz-tagged contacts are missing from Facebook, and I proceed to add them manually.

The jazz-addressbook line depends on your particular address book format, so please adapt it.

#!/bin/bash

# Create a text file containing the Facebook ids of all the people in my Facebook friends list "jazz"
cat jazz.html | sed -e "s/li class/\n/g" | grep "checkableListItem selectedCheckable" | sed -e "s/.*value=\"//g" | sed -e "s/\".*//g" | grep -v "Done" | sort > jazz-facebook

# Create a text file containing the Facebook ids of all the people marked "jazz" in my address book
cat address-book.xml | depends on your address book format | sort > jazz-addressbook

echo "Missing from Facebook:"
diff jazz-facebook jazz-addressbook | grep ">" | sed -e "s/> //g"

echo "Missing from address book:"
diff jazz-facebook jazz-addressbook | grep "<" | sed -e "s/< //g"
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.