OzBargain is now Plurking

scotty on 26/09/2009 at 10:22 pm, filed under OzBargain

Okay. I was bored. Saw a friend of mine updating her status on Plurk, which is a micro-blogging service similar to Twitter (which OzBargain already has a presence with 1000+ followers). However, all your short messages get presented on a time line together with your friends. “Hey, wouldn’t it be nice to have OzBargain plurking as well”, I thought — I could have updated the status there at the same time Twitter status was updated.

So I started coding. And it is the end result :)

OzBargain on Plurk

It happens that Plurk actually does not have a public API like Twitter. Therefore to get status updated you have to pretty much posting to the forms. Here is a code snipe in Python on how OzBargain posts to Plurk:

PLURK_USERNAME = 'your Plurk username'
PLURK_PASSWORD = 'your Plurk password'
PLURK_USERID = 'your Plurk user ID'

def plurk(msg, qualifier='says'):
    import cookielib, time, urllib, urllib2

    cookiejar = cookielib.CookieJar()
    opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(
        cookiejar))
    opener.open('http://www.plurk.com/Users/login',
        urllib.urlencode({
            'nick_name': PLURK_USERNAME,
            'password': PLURK_PASSWORD,
        }))
    opener.open('http://www.plurk.com/TimeLine/addPlurk',
        urllib.urlencode({
            'posted': time.strftime('%Y-%m-%dT%H:%M:%S', time.gmtime()),
            'qualifier': qualifier,
            'content': msg,
            'lang': 'en',
            'no_comments': '0',
            'uid': PLURK_USERID,
        }))

Note that “USERID” is a numeric value that you can find when you look at the HTML source of your Plurk page. OzBargain is 4759873 for example.

Now, follow OzBargain, if you are a Plurk user!

No Comments

Sorry, the comment form is closed at this time.