Mirroring Twitter onto Facebook, plus bells, whistles.

I just wrote this: fbmirror.pl.

It uses the Twitter API to read recent postings to the @dnalounge Twitter account and uses the Facebook API to re-post those to the DNA Facebook account.

Originally I tried to accomplish this by just having Facebook subscribe to the RSS feed of the Twitter account, but Facebook apparently only polls feeds every few days, and having "Event Foo starting now!" messages show up days late was somewhat suboptimal.

Then I tried using the Twitterfeed Facebook app, which worked ok for a while, but eventually started to suffer from random multi-day delays as well, and I got sick of the complaints.

Doing it myself also gave me the opportunity to include more detail in the Facebook post: when this script notices that the twit contains a link to a DNA event, it posts the event's flyer as an attachment to the message, along with the event description text as its caption. For example, it sees this and transforms it into this.

I did it in this somewhat roundabout way (one script posts to Twitter, another script reads from Twitter and posts to Facebook) rather than just having the first script post to Twitter and Facebook at the same time, because this way ensures that everything that gets posted to Twitter also ends up on Facebook no matter how it got there. For example, when our various bartenders use their phones to post the nightly drink specials, those posts will get mirrored as well.

Now if only I could figure out how to get the userpic on the DNA Facebook account to not look like hammered shit. I'm uploading a 200x200 PNG and Facebook converts it to a JPEG at apparently 5% quality or something, to maximize artifacting. (I've tried various sizes of JPEG too, and it shittily re-encodes them all anyway. Is there some magic sweet-spot that Facebook will leave un-transformed?)

See also: Facebook Connect comments RSS feed, finally.
And: How to use Facebook with a feed reader.
And: How to block Facebook event invitations.

Tags: , , , ,

One Response:

  1. shandrew says:

    Less jpeg destruction and higher resolution downloads are in the works and can already be seen in facebook photos. Unfortunately the Nat Geo userpic is still an artifacted garbage logo, far uglier than the DNA userpic, so these improvements may not apply to userpics.

    I can only assume that Facebook wants to prevent us from steganographically encoding copyright violations across the thousands of userpics in the thousands of accounts that every farmville player has.