Exemple #1
0
import query

while True:
  var = raw_input("\033[92mDear Introducemeto, introduce me to... \033[0m")
  try:
    print ">", [x[0] for x in query.ranked_query(str("@IntroduceMeTo " + var))]
    print ""
  except:
    print "> NO HUMANS FOUND"
    print ""
Exemple #2
0
#print status.text 

api._calculate_status_length = lambda x, y: 0

print 'Starting bot...', time.time()
last = time.time() - (1*60*5)
while True:
  print 'Checking since', last
  mentions = api.GetMentions()
  next_last = time.time()
  for t in mentions:
    if last < t.created_at_in_seconds:
      text = t.text
      user = t.user.screen_name
      print 'Found: @', user, ':', text
      rank = query.ranked_query(text)
      print ""
      print 'Top three:', rank[0:3]
      if len(rank):
        twtw = ('@' + user + ' Meet ' + ", ".join([(x[0] + ' ()') for x in rank[0:3]]))[0:74]
        for x in rank:
          twtw = twtw.replace('()', '(' + x[2].url + ')' if x[2].url else '', 1)
        status = api.PostUpdate(twtw, in_reply_to_status_id=t.id)
        print status.text
      else:
        status = api.PostUpdate('@' + user + ' There is no one for you to meet :(', in_reply_to_status_id=t.id)
      # try:
      #   if from_tweet.compare_twitter_lkdin(text, 'twitter_processing/linkedin_raw.txt') > 0.5:
      #     status = api.PostUpdate('@' + user + ' meet @timcameronryan! ' + str(time.time()))
      #   else:
      #     status = api.PostUpdate('@' + user + ' there is no one for you to meet. ' + str(time.time()))