{"id":7013,"date":"2013-09-08T17:13:10","date_gmt":"2013-09-08T17:13:10","guid":{"rendered":"http:\/\/zerokidz.com\/ideas\/?p=7013"},"modified":"2014-12-14T03:58:08","modified_gmt":"2014-12-14T08:58:08","slug":"max-twitter-client-using-ruby","status":"publish","type":"post","link":"https:\/\/reactivemusic.net\/?p=7013","title":{"rendered":"Max Twitter client using ruby"},"content":{"rendered":"<p class=\"lead\">Send and receive Tweets using Max via OSC to a background ruby server.<\/p>\n<p>An advantage of this method is that both the patch and the server are \u00a0compact and easy to understand. The Max patch does things in a Max way. And likewise with the ruby scripts.<\/p>\n<p><a href=\"https:\/\/reactivemusic.net\/wp-content\/uploads\/2013\/09\/Screen-Shot-2014-05-21-at-1.57.09-AM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-11960\" title=\"Screen Shot 2014-05-21 at 1.57.09 AM\" src=\"https:\/\/reactivemusic.net\/wp-content\/uploads\/2013\/09\/Screen-Shot-2014-05-21-at-1.57.09-AM-300x106.png\" alt=\"\" width=\"300\" height=\"106\" srcset=\"https:\/\/reactivemusic.net\/wp-content\/uploads\/2013\/09\/Screen-Shot-2014-05-21-at-1.57.09-AM-300x106.png 300w, https:\/\/reactivemusic.net\/wp-content\/uploads\/2013\/09\/Screen-Shot-2014-05-21-at-1.57.09-AM-1024x363.png 1024w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<h3>download<\/h3>\n<p><a href=\"https:\/\/github.com\/tkzic\/internet-sensors\">https:\/\/github.com\/tkzic\/internet-sensors<\/a><\/p>\n<p>folder: twitter-ruby<\/p>\n<h3>files<\/h3>\n<h5>Max<\/h5>\n<ul>\n<li>twitter-client.maxpat<\/li>\n<\/ul>\n<h5>ruby<\/h5>\n<ul>\n<li>twitter-server-send.rb (for sending Tweets)<\/li>\n<li>twitter-server-get.rb (for receiving Tweets)<\/li>\n<\/ul>\n<h6>ruby gems<\/h6>\n<p>The ruby script requires installation of the following gems<\/p>\n<ul>\n<li>json<\/li>\n<li>osc-ruby<\/li>\n<li>twitter<\/li>\n<\/ul>\n<p>For example:<\/p>\n<pre># sudo gem install twitter<\/pre>\n<pre><\/pre>\n<pre><\/pre>\n<h3>Twitter authorization<\/h3>\n<p><span style=\"line-height: 1.6;\">In addition to having a Twitter account, you will need to set up a Twitter application from the developer site here:<\/span><\/p>\n<p><a href=\"https:\/\/dev.twitter.com\/apps\">https:\/\/dev.twitter.com\/apps<\/a><\/p>\n<p>Good instructions on how to do this can be found in this stackoverflow.com post under this heading:\u00a0<strong>So you want to use the Twitter v1.1 API?<\/strong><\/p>\n<p><a href=\"http:\/\/stackoverflow.com\/questions\/12916539\/simplest-php-example-for-retrieving-user-timeline-with-twitter-api-version-1-1\">http:\/\/stackoverflow.com\/questions\/12916539\/simplest-php-example-for-retrieving-user-timeline-with-twitter-api-version-1-1<\/a><\/p>\n<p>When you get to step 5 \u2013 in the instructions \u2013 instead of writing your own code, just use a text editor to copy your access tokens into these ruby programs:<\/p>\n<ul>\n<li>twitter-server-send.rb<\/li>\n<li>twitter-server-get.rb<\/li>\n<\/ul>\n<p>Replace the strings in this line of code by copying and pasting the appropriate ones from your Twitter application:<\/p>\n<div style=\"line-height: 1.6;\">\n<div id=\"highlighter_453739\">\n<div>\n<pre>twitterClient = Twitter::REST::Client.new do |config|\r\n  config.consumer_key = &quot;mqQtoYh16343tDFG3BK7QQ&quot;       \r\n  config.consumer_secret = &quot;X0KexjlK49fhhrnn9EztapZfATCQqWCc5fXVJH2pE&quot;      \r\n  config.oauth_token = &quot;205589709-5krgh9FR3KkLGRDnewiU7GKKBMA6i2La84c&quot;       \r\n  config.oauth_token_secret = &quot;LNARAeooN2vkklkF006GRdihQ5D8YYkm8dYvEs68M&quot;  \r\nend<\/pre>\n<\/div>\n<div><\/div>\n<div>Yeah \u2013 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.<\/div>\n<\/div>\n<\/div>\n<h3>instructions<\/h3>\n<p>(note: currently running with ruby version 2.0) Display your ruby version by typing: ruby &#8211;version<\/p>\n<h5>Sending Tweets<\/h5>\n<ul>\n<li>Open the Max patch: twitter-client.maxpat<\/li>\n<li>In a terminal window run the ruby script:<\/li>\n<\/ul>\n<div class=\"panel\">\n<pre># .\/twitter-server-send.rb<\/pre>\n<\/div>\n<pre><\/pre>\n<ul>\n<li><span style=\"line-height: 1.6;\">In the Max patch, type in a Tweet. Press the green button to send.<\/span><span style=\"line-height: 1.6;\">\u00a0<\/span><\/li>\n<\/ul>\n<ul>\n<li>When you have tweeted enough, end the ruby server program by typing &lt;ctrl-c&gt;<\/li>\n<\/ul>\n<h5>\u00a0Receiving Tweets<\/h5>\n<ul>\n<li>Open the Max patch: twitter-client.maxpat<\/li>\n<li>In a terminal window run the ruby script:<\/li>\n<li>From Twitter, send a Tweet to the user name embedded in the server<\/li>\n<\/ul>\n<div class=\"panel\">\n<pre># .\/twitter-server-get.rb<\/pre>\n<\/div>\n<p>Both ruby servers can run at the same time.<\/p>\n<h4>What&#8217;s next?<\/h4>\n<ul>\n<li><span style=\"line-height: 1.6;\">Parse incoming Tweets into various components<\/span><\/li>\n<li><span style=\"line-height: 1.6;\">Combine the 2 Ruby servers<\/span><\/li>\n<\/ul>\n<p><span style=\"font-size: 23px; font-weight: bold; line-height: 1.1;\">revision history<\/span><\/p>\n<ul>\n<li>5\/21\/2014 &#8211; refactored app names. Added receive server<\/li>\n<li>5\/19\/2004 &#8211; moved to twitter-ruby folder<\/li>\n<li>1\/18\/2014 &#8211; minor fixes to ruby server for current ruby version 2.0<\/li>\n<li>9\/7\/2013 &#8211; uses oauth to communicate directly to Twitter from ruby<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>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 \u00a0compact and easy to understand. The Max patch does things in a Max way. And likewise with the ruby scripts. download https:\/\/github.com\/tkzic\/internet-sensors folder: twitter-ruby files Max twitter-client.maxpat ruby &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/reactivemusic.net\/?p=7013\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Max Twitter client using ruby&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","footnotes":""},"categories":[143,275],"tags":[161,46,345,190,202,26,136],"class_list":["post-7013","post","type-post","status-publish","format-standard","hentry","category-interactive-media-art","category-internet-sensors","tag-api","tag-connections","tag-maxmsp","tag-portfolio","tag-ruby","tag-sensors","tag-twitter"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Max Twitter client using ruby - reactive music<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/reactivemusic.net\/?p=7013\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Max Twitter client using ruby - reactive music\" \/>\n<meta property=\"og:description\" content=\"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 \u00a0compact and easy to understand. The Max patch does things in a Max way. And likewise with the ruby scripts. download https:\/\/github.com\/tkzic\/internet-sensors folder: twitter-ruby files Max twitter-client.maxpat ruby &hellip; Continue reading &quot;Max Twitter client using ruby&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/reactivemusic.net\/?p=7013\" \/>\n<meta property=\"og:site_name\" content=\"reactive music\" \/>\n<meta property=\"article:published_time\" content=\"2013-09-08T17:13:10+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2014-12-14T08:58:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/reactivemusic.net\/wp-content\/uploads\/2013\/09\/Screen-Shot-2014-05-21-at-1.57.09-AM-300x106.png\" \/>\n<meta name=\"author\" content=\"Tom Zicarelli\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Tom Zicarelli\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=7013#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=7013\"},\"author\":{\"name\":\"Tom Zicarelli\",\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/#\\\/schema\\\/person\\\/56224d281582df7e5518e037ca63e571\"},\"headline\":\"Max Twitter client using ruby\",\"datePublished\":\"2013-09-08T17:13:10+00:00\",\"dateModified\":\"2014-12-14T08:58:08+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=7013\"},\"wordCount\":379,\"image\":{\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=7013#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/reactivemusic.net\\\/wp-content\\\/uploads\\\/2013\\\/09\\\/Screen-Shot-2014-05-21-at-1.57.09-AM-300x106.png\",\"keywords\":[\"API\",\"connections\",\"Max\\\/MSP\",\"portfolio\",\"ruby\",\"sensors\",\"Twitter\"],\"articleSection\":[\"interactive media art\",\"internet-sensors\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=7013\",\"url\":\"https:\\\/\\\/reactivemusic.net\\\/?p=7013\",\"name\":\"Max Twitter client using ruby - reactive music\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=7013#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=7013#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/reactivemusic.net\\\/wp-content\\\/uploads\\\/2013\\\/09\\\/Screen-Shot-2014-05-21-at-1.57.09-AM-300x106.png\",\"datePublished\":\"2013-09-08T17:13:10+00:00\",\"dateModified\":\"2014-12-14T08:58:08+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/#\\\/schema\\\/person\\\/56224d281582df7e5518e037ca63e571\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=7013#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/reactivemusic.net\\\/?p=7013\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=7013#primaryimage\",\"url\":\"https:\\\/\\\/reactivemusic.net\\\/wp-content\\\/uploads\\\/2013\\\/09\\\/Screen-Shot-2014-05-21-at-1.57.09-AM.png\",\"contentUrl\":\"https:\\\/\\\/reactivemusic.net\\\/wp-content\\\/uploads\\\/2013\\\/09\\\/Screen-Shot-2014-05-21-at-1.57.09-AM.png\",\"width\":\"2122\",\"height\":\"754\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=7013#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/reactivemusic.net\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Max Twitter client using ruby\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/#website\",\"url\":\"https:\\\/\\\/reactivemusic.net\\\/\",\"name\":\"reactive music\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/reactivemusic.net\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/#\\\/schema\\\/person\\\/56224d281582df7e5518e037ca63e571\",\"name\":\"Tom Zicarelli\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0da58cf21a2707dd335b204b8ed3cd9194dcbf9d9814ac5d71195a65c76c8a72?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0da58cf21a2707dd335b204b8ed3cd9194dcbf9d9814ac5d71195a65c76c8a72?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0da58cf21a2707dd335b204b8ed3cd9194dcbf9d9814ac5d71195a65c76c8a72?s=96&d=mm&r=g\",\"caption\":\"Tom Zicarelli\"},\"sameAs\":[\"http:\\\/\\\/tomzicarelli.com\"],\"url\":\"https:\\\/\\\/reactivemusic.net\\\/?author=2\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Max Twitter client using ruby - reactive music","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/reactivemusic.net\/?p=7013","og_locale":"en_US","og_type":"article","og_title":"Max Twitter client using ruby - reactive music","og_description":"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 \u00a0compact and easy to understand. The Max patch does things in a Max way. And likewise with the ruby scripts. download https:\/\/github.com\/tkzic\/internet-sensors folder: twitter-ruby files Max twitter-client.maxpat ruby &hellip; Continue reading \"Max Twitter client using ruby\"","og_url":"https:\/\/reactivemusic.net\/?p=7013","og_site_name":"reactive music","article_published_time":"2013-09-08T17:13:10+00:00","article_modified_time":"2014-12-14T08:58:08+00:00","og_image":[{"url":"https:\/\/reactivemusic.net\/wp-content\/uploads\/2013\/09\/Screen-Shot-2014-05-21-at-1.57.09-AM-300x106.png","type":"","width":"","height":""}],"author":"Tom Zicarelli","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Tom Zicarelli","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/reactivemusic.net\/?p=7013#article","isPartOf":{"@id":"https:\/\/reactivemusic.net\/?p=7013"},"author":{"name":"Tom Zicarelli","@id":"https:\/\/reactivemusic.net\/#\/schema\/person\/56224d281582df7e5518e037ca63e571"},"headline":"Max Twitter client using ruby","datePublished":"2013-09-08T17:13:10+00:00","dateModified":"2014-12-14T08:58:08+00:00","mainEntityOfPage":{"@id":"https:\/\/reactivemusic.net\/?p=7013"},"wordCount":379,"image":{"@id":"https:\/\/reactivemusic.net\/?p=7013#primaryimage"},"thumbnailUrl":"https:\/\/reactivemusic.net\/wp-content\/uploads\/2013\/09\/Screen-Shot-2014-05-21-at-1.57.09-AM-300x106.png","keywords":["API","connections","Max\/MSP","portfolio","ruby","sensors","Twitter"],"articleSection":["interactive media art","internet-sensors"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/reactivemusic.net\/?p=7013","url":"https:\/\/reactivemusic.net\/?p=7013","name":"Max Twitter client using ruby - reactive music","isPartOf":{"@id":"https:\/\/reactivemusic.net\/#website"},"primaryImageOfPage":{"@id":"https:\/\/reactivemusic.net\/?p=7013#primaryimage"},"image":{"@id":"https:\/\/reactivemusic.net\/?p=7013#primaryimage"},"thumbnailUrl":"https:\/\/reactivemusic.net\/wp-content\/uploads\/2013\/09\/Screen-Shot-2014-05-21-at-1.57.09-AM-300x106.png","datePublished":"2013-09-08T17:13:10+00:00","dateModified":"2014-12-14T08:58:08+00:00","author":{"@id":"https:\/\/reactivemusic.net\/#\/schema\/person\/56224d281582df7e5518e037ca63e571"},"breadcrumb":{"@id":"https:\/\/reactivemusic.net\/?p=7013#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/reactivemusic.net\/?p=7013"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/reactivemusic.net\/?p=7013#primaryimage","url":"https:\/\/reactivemusic.net\/wp-content\/uploads\/2013\/09\/Screen-Shot-2014-05-21-at-1.57.09-AM.png","contentUrl":"https:\/\/reactivemusic.net\/wp-content\/uploads\/2013\/09\/Screen-Shot-2014-05-21-at-1.57.09-AM.png","width":"2122","height":"754"},{"@type":"BreadcrumbList","@id":"https:\/\/reactivemusic.net\/?p=7013#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/reactivemusic.net\/"},{"@type":"ListItem","position":2,"name":"Max Twitter client using ruby"}]},{"@type":"WebSite","@id":"https:\/\/reactivemusic.net\/#website","url":"https:\/\/reactivemusic.net\/","name":"reactive music","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/reactivemusic.net\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/reactivemusic.net\/#\/schema\/person\/56224d281582df7e5518e037ca63e571","name":"Tom Zicarelli","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/0da58cf21a2707dd335b204b8ed3cd9194dcbf9d9814ac5d71195a65c76c8a72?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/0da58cf21a2707dd335b204b8ed3cd9194dcbf9d9814ac5d71195a65c76c8a72?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0da58cf21a2707dd335b204b8ed3cd9194dcbf9d9814ac5d71195a65c76c8a72?s=96&d=mm&r=g","caption":"Tom Zicarelli"},"sameAs":["http:\/\/tomzicarelli.com"],"url":"https:\/\/reactivemusic.net\/?author=2"}]}},"_links":{"self":[{"href":"https:\/\/reactivemusic.net\/index.php?rest_route=\/wp\/v2\/posts\/7013","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/reactivemusic.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/reactivemusic.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/reactivemusic.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/reactivemusic.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7013"}],"version-history":[{"count":27,"href":"https:\/\/reactivemusic.net\/index.php?rest_route=\/wp\/v2\/posts\/7013\/revisions"}],"predecessor-version":[{"id":17828,"href":"https:\/\/reactivemusic.net\/index.php?rest_route=\/wp\/v2\/posts\/7013\/revisions\/17828"}],"wp:attachment":[{"href":"https:\/\/reactivemusic.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7013"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/reactivemusic.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7013"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/reactivemusic.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7013"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}