Posted By


tamuratetsuya on 03/17/09

Statistics


Viewed 617 times
Favorited by 0 user(s)

twitterで自分のfollowerを取得


/ Published in: Python
Save to your folder(s)



Copy this code and paste it in your HTML
  1. def getFollowers():
  2. #url作成
  3. followers=[]
  4. url = 'http://twitter.com/statuses/followers.xml'
  5. print >>sys.stderr,url
  6. base64string =b64encode("%s:%s" % (username, password))
  7. headers = {"Authorization": "Basic %s" % base64string}
  8. xml_result=urlfetch.fetch(url, payload='', method=urlfetch.POST, headers=headers).content
  9. for soup in BeautifulSoup(xml_result)('screen_name'):
  10. #print >>sys.stderr,soup(text = True)[0]
  11. followers.append(soup(text = True)[0])
  12. return followers

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.