Advertisement
Guest User

Untitled

a guest
May 9th, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.69 KB | None | 0 0
  1. import twitter # easy_install python-twitter
  2. import getpass
  3.  
  4. SCOBLE = 21.21 # tweets/day (velocity)
  5. WHETON = 500000 # followers (mass)
  6. COUNT = 200
  7. MAX_TWEETS = 1000
  8. username = raw_input("Username: ")
  9. password = getpass.getpass("Password: ")
  10.  
  11. api = twitter.Api(username=username, password=password)
  12.  
  13. messages = []
  14. since_id = None
  15.  
  16. friends = api.GetFriends()
  17.  
  18. # Get at most MAX_TWEETS
  19. print "Getting %s tweets" % (MAX_TWEETS, )
  20. for i in range(0, MAX_TWEETS / COUNT):
  21.     messages += api.GetFriendsTimeline(count=200,
  22.                                        since_id=since_id)
  23.  
  24.     if messages:
  25.         since_id = messages[-1].id
  26.  
  27.     print "Got %s tweets" % (len(messages), )
  28.     # If messages is empty break the loop, we can't go on.
  29.     if not messages:
  30.         break
  31.  
  32. first = messages[0]
  33. last = messages[-1]
  34.  
  35. # Get the time elapsed from the first tweet until the last
  36. elapsed = float(first.created_at_in_seconds - last.created_at_in_seconds)
  37.  
  38. # Get the number of tweet over that time
  39. tweet_count = float(len(messages))
  40.  
  41. # get the tweets per second
  42. tps = tweet_count / elapsed
  43.  
  44. # convert that into tpd
  45. tpd = tps * 24 * 60 * 60
  46.  
  47. # Calculate the scoble value
  48. scobles = tpd / SCOBLE
  49.  
  50. # Calculate whetons
  51. whetons = float(len(friends)) / WHETON
  52.  
  53.  
  54.  
  55. print "Your friends have:"
  56. print "Tweets/Day: %s" % (tpd, )
  57. print "Speed: %s scobles" % (scobles, )
  58.  
  59.  
  60. if whetons > 1:
  61.     print "Mass: %s wheton" % whetons
  62. else:
  63.     # Use milliwhetons for
  64.     mw = whetons * 1000
  65.     print "Mass: %s milliwhetons" % mw
  66.  
  67. print "Momentium: %s Whetonscobles" % (whetons * scobles)
  68.  
  69. print "Disclaimer: I know a Wheton is a unit of measurement of followers and not friends, but whatever."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement