Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Visualize Twitter Hashtags in Real Time

Visualize Twitter Hashtags in Real Time

This is a talk I gave at SDRuby (sdruby.org) about the process of monitoring the Twitter live stream API for certain keywords and then visualizing retweets in real time using Arbor.js.

Avatar for Etienne de Bruin

Etienne de Bruin

April 19, 2012
Tweet

More Decks by Etienne de Bruin

Other Decks in Programming

Transcript

  1. MonkDev, Inc. • Established 2006 • Old Town, San Diego

    • 20 Employees • We host Ruby Hack Nights! • NEXT ONE IS NEXT WEEK (NONW)!
  2. Awesome new project • Visualize Retweets in real time •

    4 stakeholders • 31% equity • 2 months to do it • GO! We demo in May.
  3. Streaming API • Rate Limited • One persistent connection per

    account • intridea/tweetstream • OAuth
  4. REST API • Rate Limited • Unauthenticated 150/hr (~2/min) •

    Authenticated 350/hr (~5/min) • jnunemaker/twitter
  5. Two types of RT • Retweet • retweeted_status: true •

    original status_id (and user_id) • Quote Tweet • no mention of retweet • no original status_id • no guarantees on status text
  6. incr Increment tweet counter set/get Store as string type rpush

    Append tweet to list zadd Add user to sorted set lrange Return list of new tweets expire Expire api counter key
  7. Heroku Procfile web: bundle exec thin start -e $RACK_ENV -p

    $PORT worker: QUEUE=* bundle exec rake environment resque:work stream: bundle exec lib/tasks/stream_campaign.rb