Gray's Matter
Justice Gray - North America's favorite metrosexual software consultant
E-mail Justice
Subscribe to this feed
Subscribe to comments
Perennially Popular Posts
How to write a presentation abstract
My grandmother, globalization, and what's wrong with DateTime.Parse
A letter to my Worldvision sponsor child
Development Methodologies for the 21st Century
My grandmother & the difference between strong typing and weak typing
How I am becoming a better developer, part 1 of infinity
Facebook RSS Feeds: How to Write Your Own With C#
The Ten Keys To Happiness
My grandmother and the Global Assembly Cache (And Star Wars)
My grandmother and the difference between processes and threads
How to make a meeting request
Why you should never be an independent consultant
The DasBlog 1.9 AJAX Autosave True Story, Part 2
Other "metro" developers
Ben Scheirman
Bil Simser
D'Arcy Lussier
David Woods
Donald Belcham
Donald Jessop
George Clingerman
James Kovacs
Jason Hunt
Jason Row
Jean-Paul Boodhoo
Jeffrey Palermo
Joey deVilla
John Bristowe
Jonas Avellana
Kyle Baley
Mack Male
Martin Hinselwood
Michael McClenaghan
Mike Duncan
Mike Friesen
Mo Khan
Otyce
RoboSapient
Russell Ball
Scott Hanselman
Scott Reynolds
Steven Rockarts
Tech Embassy
Terry Thibodeau
Tom Opgenorth
Vladimir Levin
The Justice Gray Fan Club
Amazing Mrs. Loquacious
Dr. Teeth
Facedown
Janey Lynne
Maxime Lamy
Ridley Thunder
Stan Woo
Vanilla Con
Wobbly*Bits
I Wish These People Updated More Than Once a Year
Anand Narayan
Jeff Perrin
<< Donald Belcham is now a MICROSOFT MVP~~~!!!!!!
Hot Developer Corner #01: David Woods >>
Facebook RSS Feeds: How to write your own with C#
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:
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?
Saturday, April 07, 2007
Comments [22]
Technical
|
Tracked by:
"We're through, Jason Haley" (Gray's Matter)
[Trackback]
"A fireside chat with Justice Gray" (Gray's Matter)
[Trackback]
4/6/2007 7:59:53 PM (Mountain Daylight Time, UTC-06:00)
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!
Mack D. Male
|
mackAT NOSPAMparamagnus dot com
4/6/2007 8:05:30 PM (Mountain Daylight Time, UTC-06:00)
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.
Mack D. Male
|
mackAT NOSPAMparamagnus dot com
4/7/2007 8:52:36 AM (Mountain Daylight Time, UTC-06:00)
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. (??)
Justice~!
4/7/2007 2:10:51 PM (Mountain Daylight Time, UTC-06:00)
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.
Mack D. Male
|
mackAT NOSPAMparamagnus dot com
4/8/2007 1:00:17 AM (Mountain Daylight Time, UTC-06:00)
I can't believe you referenced Steve 3 times in your blog!... but thanks for throwing me in there :P
Cat
|
catty1977AT NOSPAMhotmail dot com
4/8/2007 2:11:49 AM (Mountain Daylight Time, UTC-06:00)
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! ;)
Justice~!
4/9/2007 8:42:39 PM (Mountain Daylight Time, UTC-06:00)
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.
Jason Row
|
jason dot rowAT NOSPAMgmail dot com
4/9/2007 8:48:01 PM (Mountain Daylight Time, UTC-06:00)
RSS Feeds don't work when I'm not at home, stalker man!! ;) You're in now.
Justice~!
4/10/2007 8:37:47 AM (Mountain Daylight Time, UTC-06:00)
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.
Jason Row
|
jason dot rowAT NOSPAMgmail dot com
4/10/2007 11:54:15 AM (Mountain Daylight Time, UTC-06:00)
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!?!
Justice
4/10/2007 2:14:28 PM (Mountain Daylight Time, UTC-06:00)
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.
Donald Belcham
4/10/2007 2:15:50 PM (Mountain Daylight Time, UTC-06:00)
Buddy, I'm thinking that if you want dates, Facebook is the place!! Tons of women on there looking for hookups, I am sure.
Justice
4/11/2007 7:21:01 AM (Mountain Daylight Time, UTC-06:00)
"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.
The Coding Hillbilly
4/11/2007 7:48:58 AM (Mountain Daylight Time, UTC-06:00)
Don't worry, Kyle - your hairstyling tips will remain a closely guarded secret between you and I.
Or did I say too much?
Justice~!
4/28/2007 6:04:07 AM (Mountain Daylight Time, UTC-06:00)
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
Tom Holden
|
thomas dot holdenAT NOSPAMgmail dot com
4/28/2007 7:00:36 AM (Mountain Daylight Time, UTC-06:00)
(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
Tom Holden
|
thomas dot holdenAT NOSPAMgmail dot com
4/29/2007 7:00:03 PM (Mountain Daylight Time, UTC-06:00)
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!
Alex
5/2/2007 4:58:42 AM (Mountain Daylight Time, UTC-06:00)
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
Tom Holden
|
thomas dot holdenAT NOSPAMgmail dot com
8/3/2007 9:02:45 PM (Mountain Daylight Time, UTC-06:00)
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
Jimbo
|
jrutlandAT NOSPAMvodafone dot net
11/14/2007 9:36:29 AM (Mountain Standard Time, UTC-07:00)
Any addiction is bad for i can tell you that....
drug rehab program
|
sabinaAT NOSPAMyahoo dot com
3/22/2008 9:39:02 AM (Mountain Daylight Time, UTC-06:00)
Brand Wellbutrin Delivered
get original wellbutrin
|
jetplanelyAT NOSPAMmodelplane dot com
3/22/2008 9:45:14 AM (Mountain Daylight Time, UTC-06:00)
Wellbutrin With Online Consultation Online
Ordering Discount Wellbutrin
|
hertzcarrentalAT NOSPAMhertzcarrental dot org
Name
E-mail
Home page
Remember Me
Comment (HTML not allowed)
Enter the code shown (prevents robots):
Justice Gray
: a seething cauldron of rampaging masculinity. A fighter! A brother! Your
secret lover
! He's also a software development consultant and the Vice President of the
Edmonton .NET user group
. He also greatly enjoys speaking about himself in the 3rd person.
Gray's Matter Archives
Recent Posts
Controversy clarifications!
The most controversial interview of ALL TIME
Finally! The *winner* of the "What Justice Gray Means to Me" contest
The mystery of D'Arcy Lussier's ASP.NET MVP is solved...
Well, now that's pretty horrifying
MVPs on MVC: "No, we don't have any idea either"
Why I am happy to not be at the MVP Summit
Donald Belcham's cry for help: MS MVPs, your attention is needed
ALT.NET Pursefighting revealed
Test, please ignore!
Change yourself, change the world: a great week 4
Post Categories
BookReviews
Conferences
DasBlog
EDMUG
Goals
HanselmanQuestions
HotDeveloperCorner
ILiveToInform
Leadership
Mac
OtherGrayAreas
Personal
Productivity
Ruby
Suresh
Technical
Transformers
Vancouver
Wii
<
July 2008
>
Sun
Mon
Tue
Wed
Thu
Fri
Sat
29
30
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
1
2
3
4
5
6
7
8
9
Sign In