Advertisement
Guest User

twitterscript.py

a guest
Aug 30th, 2010
881
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # requires http://code.google.com/p/python-twitter/
  2. import twitter
  3. api = twitter.Api(username='yourusername', password='apassword')
  4.  
  5.  
  6. def getAllFriends(username):
  7.   myuser = api.GetUser(username)
  8.   howmany = myuser.GetFriendsCount()
  9.   mylist = []
  10.   while(len(mylist)<howmany):
  11.     mylist += api.GetFriends(myuser.screen_name, len(mylist)-1)
  12.   return [u.screen_name for u in mylist]
  13.  
  14. if __name__=="__main__":
  15.  user1=getAllFriends("username1")
  16.  user2=getAllFriends("username2")
  17.  intersection = list(set(user1) & set(user2))
  18.  print [u for u in intersection]
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement