Javascript client side method to search Tweets bypassing Oauth.

Uses Twitter Widgets – parsing the ‘JSON like response’ using Jquery.

By Jason Mayes

Here is a sample URL that returns a response for the hashtag #cats using my widget: If you set up a Twitter widget, just replace the ID number in the URL with the one that shows up when you run your widget.

Here is a derivative project by Alessio Zappa that doesn’t use Jquery:

This method is not approved by Twitter. Use at your own risk:

local version – tkzic/Twitter-Post-Fetcher-master/



“Conversnitch is a small device that automatically tweets overheard conversations, bridging the gap between (presumed) private physical space and public space online.”

By Brian House and Kyle McDonald

Note: 6/2021 – This project has not been updated for 7 years, but surveillance is alive and well.

(Uses Raspberry Pi)

Ruby tweetstream gem

Access to the Twitter streaming API


This gem looks to be a possible solution for connecting Max to Google Maps. I’m guessing that the code will look very similar to the ruby code which uses the twitter gem for status updates.

Here’s a blog entry:

Client documentation:

Here’s the Twitter documentation on whats getting returned:


Max Twitter client using ruby

Send and receive Tweets using Max via OSC to a background ruby server.

An advantage of this method is that both the patch and the server are  compact and easy to understand. The Max patch does things in a Max way. And likewise with the ruby scripts.


folder: twitter-ruby


  • twitter-client.maxpat
  • twitter-server-send.rb (for sending Tweets)
  • twitter-server-get.rb (for receiving Tweets)
ruby gems

The ruby script requires installation of the following gems

  • json
  • osc-ruby
  • twitter

For example:

# sudo gem install twitter

Twitter authorization

In addition to having a Twitter account, you will need to set up a Twitter application from the developer site here:

Good instructions on how to do this can be found in this post under this heading: So you want to use the Twitter v1.1 API?

When you get to step 5 – in the instructions – instead of writing your own code, just use a text editor to copy your access tokens into these ruby programs:

  • twitter-server-send.rb
  • twitter-server-get.rb

Replace the strings in this line of code by copying and pasting the appropriate ones from your Twitter application:

twitterClient = do |config|
  config.consumer_key = "mqQtoYh16343tDFG3BK7QQ"       
  config.consumer_secret = "X0KexjlK49fhhrnn9EztapZfATCQqWCc5fXVJH2pE"      
  config.oauth_token = "205589709-5krgh9FR3KkLGRDnewiU7GKKBMA6i2La84c"       
  config.oauth_token_secret = "LNARAeooN2vkklkF006GRdihQ5D8YYkm8dYvEs68M"  
Yeah – its cryptic, but trivial compared to writing the ouath code. Just a reminder, if even one letter or quote mark, or anything is out of place, the authorization will fail.


(note: currently running with ruby version 2.0) Display your ruby version by typing: ruby –version

Sending Tweets
  • Open the Max patch: twitter-client.maxpat
  • In a terminal window run the ruby script:
# ./twitter-server-send.rb

  • In the Max patch, type in a Tweet. Press the green button to send. 
  • When you have tweeted enough, end the ruby server program by typing <ctrl-c>
 Receiving Tweets
  • Open the Max patch: twitter-client.maxpat
  • In a terminal window run the ruby script:
  • From Twitter, send a Tweet to the user name embedded in the server
# ./twitter-server-get.rb

Both ruby servers can run at the same time.

What’s next?

  • Parse incoming Tweets into various components
  • Combine the 2 Ruby servers

revision history

  • 5/21/2014 – refactored app names. Added receive server
  • 5/19/2004 – moved to twitter-ruby folder
  • 1/18/2014 – minor fixes to ruby server for current ruby version 2.0
  • 9/7/2013 – uses oauth to communicate directly to Twitter from ruby

Tweet from Max with ruby

Update 6/2014: working version here:


The trigger method of sending tweets from Max is limited by number of tweets and sync rate. So it would be nice to set up another intermediary server program in ruby or php which eliminates the middle-man and just sends tweets directly.

Or you could use the mxj searchTweet program, which has been updated to do this on the search side.

twitter gem

update: Got it working with this gem: Its much easier than dealing with xively.


how to destroy a tweet:

how to get a timeline:

example of error handling code:

num_attempts = 0
  num_attempts += 1
  retweets = Twitter.retweeted_by_user("sferik")
rescue Twitter::Error::TooManyRequests => error
  if num_attempts <= MAX_ATTEMPTS
    # NOTE: Your process could go to sleep for up to 15 minutes but if you
    # retry any sooner, it will almost certainly fail with the same exception.
    sleep error.rate_limit.reset_in


Another useful SO post: