Wednesday, December 24, 2008

The Facebook Status Updater

So... I made a little script to calculate the time till Christmas and automatically update your Facebook status...

Requires Python and PyFacebook.

(This is a great way to annoy your friends if you change the wait time to .5 or some ridculously small number to flood their feed...) 

#! /usr/bin/env python

import facebook
import time
import string

def update():
    difference = 1230181201 - round(time.time())
    return "%.0f Hours and %.0f minutes till Christmas" %(round((difference/3600)-.5), round((difference%3600)/60-.5))

if __name__=="__main__":
    api_key = 'YOUR API KEY'
    secret_key = 'YOUR SECRET KEY'

    facebook = facebook.Facebook(api_key, secret_key)

    facebook.auth.createToken()

    # Show login window
    # Set popup=True if you want login without navigational elements
    facebook.login()

    # Login to the window, then press enter
    print 'After logging in, press enter... '
    raw_input()
    
    #Uncomment to following block if this is the first time
    #print 'Now you will need to authorize this script to update your status'
    #facebook.request_extended_permission("status_update", popup=False)
    #raw_input()
    
    facebook.auth.getSession()
   
    while (time.time() <1230181201) :
        facebook.users.setStatus(update() , False)
        time.sleep(58)
    
    facebook.users.setStatus("CHRISTMAS!!!" , False)
    






-runiteking1

Got comments? Post them below!

No comments:

Post a Comment