Skip to content

Search script

robertogithub edited this page Jul 30, 2013 · 4 revisions

The pseudo code for the search script is:

(script executed every 15 minutes using cron or similar) # this is a limit on Twitter Search API

query_counter = 0
for every term stored on the db ordered by term.last_execution
  get the last_tweet_id for the term
  perform the TwitterSearch using the last_tweet_id
  
  for every received tweet
    calculate some columns (gender and probably others...)
    save the tweet
    update the variable last_received_tweet_id
  end

  term.last_tweet_id = last_received_tweet_id
  term.last_execution = now
  update term

  query_counter += 1
  if query_counter >= 180 then exit # this is a limit on Twitter Search API
end
Clone this wiki locally