Gray's Matter
Justice Gray - North America's Favorite Metrosexual Urban Legend
   by Justice~! Technical  
Facebook RSS Feeds - How to write your own

As you can see from the above picture, I have been busy coding something that will change the lives of EVERYONE IT TOUCHES.  We'll get to that, but first I want to talk a little bit about the Facebook phenomenon.

For those of you who don't know what Facebook is, my wife has written an excellent primer on the subject, and so has Mack Male.  It seems to have taken off in a big way thanks to its slick UI and social networking features.  For the time being, Facebook is the place to be for geeks and non-geeks alike.  My wife, Mack Male, Steven Rockarts, Ridley Thunder, and Catherine Silzer are only a *few* of the names you can find hanging out on Facebook.    Even Kyle Baley is there, despite being notoriously anti-social to the point of barricading himself in the Bahamas so he can "just be away from all those filthy plebes".   Today the Facebook community recieved another newbie in the form of D'Arcy Lussier, who claimed that he was just signing up because "all of my non-geek friends are doing it".  *PLEASE*.   I think we all know why D'Arcy all of a sudden felt the driving need to be on Facebook:

John Bristowe is in Facebook - D'Arcy Lussier is orgasmic

Some things never change.  Can a restraining order be far away?

Anyway, I like Facebook as it allows me to keep in touch with some of my friends who are less technical, and reunite with some old friends who I never thought I'd see or hear from again.  If the price of this is to refuse the same message of "Can you confirm you and Steve Rockarts hooked up?" 25 times, then so be it.   However, there are two things that I dislike about Facebook:

a) I have to login every time someone takes an action towards me
b) The "news feed" on their main page that updates you on your friend's activities, messages, wall posts is not exposed as an RSS feed, so you constantly have to login to get that as well.

I, my friends, have solved this problem by writing my own Facebook RSS feed.    So can you - all you need is the .NET Framework 2.0 and some familiarity with C# !!   I need to say that Nemik's efforts in PHP were a huge help in my figuring out what needed to be done here and he deserves a large amount of credit.   Also thanks to David Woods and Steven Rockarts for helping piece together a nagging issue and to Kyle Baley for being a huge show-off!  

The files are attached here, including a small readme with what you need to do to get this going.  Please note you will need to change the E-mail and password from "YOUR_EMAIL" and "YOUR_PASSWORD" if you want this to work.  If there are any *other* issues with the code, please feel free to contact me either via E-mail or preferably via blog comment on this post and let me know!  

At last I can get my news updates without logging in!  Although when you have stuff like this in your updates:

"Mack Male is looking for random play, ladies!"
"Mack Male is *still* looking for random play, ladies!"
"Mack Male is getting ANGRY, ladies"
"D'Arcy is wondering why John Bristowe needs to involve the police"


maybe it's better to just not login to Facebook at all?

Comments

Mack D. Male

Awesome Justice! That's funny, I did pretty much the same thing! I wrote an app that lets me update my Facebook status without having to go to the website and login, and I wanted it to show everyone else's status too.

Anyway, nicely done. Great minds think alike!

Reply

Mack D. Male

My suggestion for the code would be to use WebClient instead of the nasty HttpWebRequest and HttpWebResponse objects! Only extra step is to make a new class (WebClientEx) that inherits from WebClient and adds a CookieContainer.

Reply

Thanks for the suggestion Mack!  I'm not all that big on the WebResponse/WebRequest objects either, and your suggestion certainly sounds like it would be a bit cleaner.  

I might have to talk to you about WebClient and how its doing its POSTS; I figure WebClient saves its cookies internally (haven't checked it w/ Reflector to be sure) so I'm not worried about a CookieContainer.  But when I do the POST with a WebClient, I end up just hitting the login screen again.  (??)

Reply

Mack D. Male

Yeah, it doesn't save cookies. That's why I had to add the CookieContainer (and override a few methods). I'll send you the class via email.

Reply

Cat

I can't believe you referenced Steve 3 times in your blog!... but thanks for throwing me in there Tong

Reply

Catherine, I totally owed Steve for helping break past a *huge* stumbling point. I would've mentioned him every paragraph if I didn't know he'd get a little too excited!  ;)

Reply

Jason Row

Wow, lotta good that RSS feed is doing for you .. I've been waiting a whole 20 mins for you to accept my friend request ....  maybe it's a timezone thing and you'll catch up in 3 hours.

Reply

RSS Feeds don't work when I'm not at home, stalker man!!  ;)  You're in now.

Reply

Jason Row

Hey I'm no stalker .... just getting caught up in the FaceBook addiction.

You'd think that Donald would sign up ... what with all the friends he has and stuff.

Reply

It *must* be the fact that Donald has too many friends that he is not on Facebook.   What skeletons in his closet is he hiding!?!

Reply

Why must your comment threads always turn to discussions about me?  If I'm all you guys talk about I'm surprised it's me who can't get a damn date.

Reply

Buddy, I'm thinking that if you want dates, Facebook is the place!!  Tons of women on there looking for hookups, I am sure.

Reply

"just be away from all those filthy plebes"

Someday, I'll explain how ironic that statement is.

P.S. Don't tell anyone what I helped you with. It's bad enough people think I'm a Livelink expert at my current company.

Reply

Don't worry, Kyle - your hairstyling tips will remain a closely guarded secret between you and I.

Or did I say too much?

Reply

#15 Tom Holden  on 4/28/2007 12:04:07 PM

Tom Holden

At the moment every time I refresh the feed I get duplicates appearing.

Could you possibly save a cookie that stores the last item downloaded, and then only include items after that in the feed?

Thanks,

Tom

Reply

#16 Tom Holden  on 4/28/2007 1:00:36 PM

Tom Holden

(All less than replaced with $$, greater than with %%.)

I fixed it by using a more sensible GUID string:

rssBuilder.AppendFormat("$$guid isPermaLink=\"false\"%%$$![CDATA[{0}]]%%$$/guid%%", item.Content );

I also gave items more sensible titles with:

newFacebookItem.Title = Regex.Replace( htmlSegment, "$$[^%%]+?%%", "" );

I'm sure you can figure out where those two changes are.

Tom

Reply

#17 Alex  on 4/30/2007 1:00:03 AM

Alex

Very cool, works great.
I was researching facebook rss feeds because i want to create a feed for my digital picture frame for all my friends new pictures. I tried to tweak your code a bit to start on the photos.php page, but that's only album covers. then i tried to parse only pictures in the news feed, that wasnt good because not every new picture gets posted there. so i decided to start directly into each of my select friends profile id=whatever, and then parse their mini-feed for new pictures. the two problems are 1) when i try to use id=? instead of home.php as the start page it doesnt goto the id instead it goes to the newsfeed. once im logged in, can i redirect the stream to a new url? 2nd, and i guess everyone has this problem. the photos arent permalinked so does that mean my picture frame wont even show them properly and this is a huge waste of time? Any help would be awesome!

Reply

#18 Tom Holden  on 5/2/2007 10:58:42 AM

Tom Holden

I've fixed the broken photo links problem. I've also got proper RSS pubDate stamps working, so the times appear right in the RSS reader. I'm going to email my updated files to the author and hopefully he'll post them somewhere accessible.

Tom

Reply

Jimbo

Hi,
great idea!

just wondering if you can help me, I'm doing a port of this to delphi7, so have to do everything the old fashioned way!
have got it working fine apart from... however I tinker with the delphi implementation of regex  it only gives me every other news story as it picks up the "feed_story_wrapper clearfix"  either end of the statement, so then skips a story because it thinks the next start tag is the end of the previous one.. my question is.. is this  a bug in the delphi (pre NET) version of regex I'm using, or does yours do this as well?

Cheers,
James

Reply

get original wellbutrin

Brand Wellbutrin Delivered

Reply

Ordering Discount Wellbutrin

Wellbutrin With Online Consultation Online

Reply

#22 Rahat  on 9/15/2008 3:48:39 PM

Rahat

Hello,
I am a novice in programming Tong Just wondering if its possible to have RSS feeds of the live feeds using a third party RSS reader?
Please let me know.
Thanks in advance!

Reply

#23 binbin  on 2/8/2009 6:22:08 PM

binbin

I have imported my Rss feed of my wordpress blog in my facebook profile, unfortunately the title of each post are linked to the facebook articles pages instead to the url of my post on my website.

Do you know how I can modify this ?

Also I have deactivated comments on certain post on my wordpress blog, is it possible that certain comments be also deactivated on facebook feed ?

Thanks

Reply

Add comment

If you're going to leave a comment, please use your real name rather than a business name; otherwise it'll likely get blocked by my spam filter (or in the rare case it gets through, deleted by me manually). Thanks!


(will not be published)

  Country flag

Click to change captcha
biuquote
  • Comment
  • Preview
Loading