Skip to content

Instantly share code, notes, and snippets.

@rochacbruno
Created July 13, 2011 20:04
Show Gist options
  • Save rochacbruno/1081197 to your computer and use it in GitHub Desktop.
Save rochacbruno/1081197 to your computer and use it in GitHub Desktop.
########################################################################
# TWITTER IMAGE
########################################################################
def get_twitter_image(username):
from urllib2 import urlopen
from xml.dom.minidom import parse as domparse
apiurl = 'http://twitter.com/users/show/%s'
dom = domparse(urlopen(apiurl % username))
twitter_image = ''
for node in dom.getElementsByTagName('profile_image_url'):
#profile_image_url
twitter_image = node._get_lastChild()
return twitter_image.nodeValue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment