Thanks for your help. We've received your bug report.

Searchtweet – Design patches that respond to twitter posts.

by

Update: Version 1.1b is available to download. Version 1.0 and 1.1 do not work anymore due to changes in Twitter’s API.

Searchtweet is a mxj external that searches twitter with a given keyword and returns a desired maximum number of most recent posts, with username, date and twitter text body routed to separate outlets. The object returns a specified number of most recent twitter posts that contain a given keyword, #hashtag, or @usertag.

Advanced search queries also work:
https://support.twitter.com/articles/71577-using-advanced-search

Searchtweet uses the twitter4j library (http://twitter4j.org) programmed by Yusuke Yamamoto.

Note:
You must limit your search frequency to an absolute minimum to avoid hitting the API rate-limits. (Ex. Do not connect a [metro 10] to the inlet, your IP will be banned in no second)
Currently the plugin does not require user-authentication, and it is unclear if there is a limit for unauthenticated searches.
For more info:
https://dev.twitter.com/docs/faq

Cheers,
Gokce Kinayoglu

Searchtweet – Design patches that respond to twitter posts.

Apr 23, 2012 at 11:26am

This has got me thinking! :)

#262983
Dec 8, 2012 at 10:16pm

This is fantastic. Thank you.

#262984
Mar 21, 2013 at 6:26pm

Excellent object and tool! Forgive my naivete as the world of APIs is pretty new to me, but is there a way to limit the output of this device to a single language? The patch I’m working on is mostly pertinent in English.

Thanks for any help.

#262985
Mar 22, 2013 at 10:52am

Hi RT, and all,
The plugin works using the basic search functionality of the twitter API. I do not know if there is a way to limit searches based on country or language through specific search keywords.
Also, the twit4j offers a push-based update functionality which I did not implement in this plugin. If there are any exciting projects that needs that kind of a more “realtime” update feel free to contact me in person or here.

#262986
Apr 2, 2013 at 6:58pm

Thank you Gokce! I will let you know if I get anything interesting working.

#262987
Apr 15, 2013 at 6:11pm

Hey all,

Just for a clarification, if you are using the standard search parameters on Twitter you can search by language and by region. If you are using the Twitter Streaming API, however, the query language is different. I have yet to dig into this patch, but I wanted to see if I could be of service.

For the standard search terms, using lang:en should limit your searches to english only.

For geolocation use: geocode:40.7484918,-73.98428659999999,25km. You will need to use a third party service to determine the Latitude and Longitude of your location (The one I posed is Manhattan) and you can use the km parameter to alter the distance.

I like to use http://geocoder.us/ for finding a latitude and longitude. Just enter an address and it should output what you want.

Hopefully that helps a little to answer your question, @Gokce.

#262988
Apr 16, 2013 at 11:06am

Thanks for the information David! This is amazing.

The search parameters indeed work well with the script! There is a small trick. Max will interpret the commas in the message as separators. The message sent to the script needs to be formatted as shown below with backslashes before each comma, such as:

search geocode:40.748433,-73.985656,1km 1

Put that in a message box and wire it to the mxj directly. (Do not use the search box in the example patch.) This should give the most recent tweet sent from an area within 1km radius around the Empire State Building in New York. Tested, and here’s the result I received:

“fangirlDANosaur”
“RT @danisnotonfire: I’m currently having that classic tourist fangirl moment where I realise I know all the buildings in Manhattan from every movie/game ever. ”

Looks like she is in New York. Exciting! Now go play!

Gokce

#262989
Apr 25, 2013 at 5:52am

Hi David and Gokce,

Thanks for your precisions about language filtering and geocode. I would like to filter the tweets according to their language. But, as “search geocode:40.748433,-73.985656,1km 1″ works perfectly for me, “search voyage lang:fr 1″ returns the following errors :

java.lang.UnsupportedOperationException: does not contain an int
at com.cycling74.max.Atom.getInt(Atom.java:572)
at searchtweet.search(searchtweet.java:34)

Did I miss something ?
Thanks a lot if you would have an idea…
-Thierry

PS: Gokce: I left a question on your FB page about language filtering, before having found this page, sorry :)

#262990
Apr 25, 2013 at 7:08am

Hi David and Gokce,

I finally found the right syntax to filter by language, which is: search “voyage lang:fr” 10
It needed quotes.
Thanks, Best
-Thierry

#262991
May 4, 2013 at 12:07am

Hi Gotkce and all, is there any advice you can give me on a similar kind of thing I’m doing here? http://cycling74.com/forums/topic.php?id=47084

#262992
May 6, 2013 at 8:01am

Hi Kaibe,

I suggest you to load the plugin and play with it before starting out with your project. Once you are able to get the text output that you need from searchtweet, the rest is figuring out how to “parse” it. There are several functions that does exactly that in MSP and there are also some external libraries for string parsing and search. Good luck!

Gokce

#262993
May 13, 2013 at 7:13pm

Super cool – thanks for posting!

#262994
Jun 11, 2013 at 5:47pm

Hi – looks like something has gone sour with the api – now i get this message:

TwitterException{exceptionCode=[26d84cad-002e486e], statusCode=410, retryAfter=0, rateLimitStatus=null, version=2.2.0}

any ideas – much obliged!

shane

#262995
Jun 12, 2013 at 5:42am

Aha – twitter changed the API!

We will begin 410ing inbound API v1 traffic now. We will gradually ramp up over the next several minutes. More info: https://dev.twitter.com/docs/faq#17750

Have a show using this object in a few weeks, so if anyone has an idea, i would be very grateful and have no other choice but to buy you some beers in NYC!

#262996
Jun 12, 2013 at 5:42am

Aha – twitter changed the API!

We will begin 410ing inbound API v1 traffic now. We will gradually ramp up over the next several minutes. More info: https://dev.twitter.com/docs/faq#17750

Have a show using this object in a few weeks, so if anyone has an idea, i would be very grateful and have no other choice but to buy you some beers in NYC!

#262997
Jun 12, 2013 at 9:04am

I will take a look at this – hopefully soon!

#262998
Jun 13, 2013 at 5:44am

Cheers!

#262999
Jun 14, 2013 at 9:47am

Hey, I too noticed that my project is dead due to the API change. This is going to kill my graduation project pretty much =/

I downloaded the latest stable version of twitter4j, updated the twitter4j.jars in the libs folder, added twitter4j.examples to a Java project in Eclipse, following http://compusition.com/web/articles/maxmsp-eclipse, and added only the following to SearchTweets.jar:
import com.cycling74.max.*;
and
… extends MaxObject {

If I just copied the SearchTweets.class (not java) file to the Max folder, it just returned “Could not load class ‘SearchTweets’”

So I also tried to to create an object in Max: [mxj twitter4j.examples.search.SearchTweets] and I’m getting the following in the Max window:
(mxj) Class twitter4j.examples.search.SearchTweets is not a subclass of com/cycling74/max/MaxObject

Do I need to work on adding INLETS and OUTLETS? Did I miss out anything else I should add?
What can I do to get this working? Any help would be supremely appreciated!!

#263000
Jun 14, 2013 at 10:43am

Guys do not panic. I will check this today.

#263001
Jun 14, 2013 at 12:58pm

Done :). Please download and *test* the new version. User discretion advised! Let me know how it works.

#263002
Jun 14, 2013 at 1:24pm

First off – thanks so much for even taking a look – i’ll never forget my 12th grade math teacher’s sign on her desk – a crisis on your part is not a crisis for me!

very cool – and please let me know if you are ever in NYC – you have some libations coming your way.

cheers!

#263003
Jun 14, 2013 at 7:19pm

You, sir, are aces.. and spades.. and I can’t really explain how much this means to me! Let’s just say you saved my college Graduation Project – and also me, from breaking my head with Java and Eclipse.. Hehe..

DRKOSS put it very well, and I agree 100% :)

I’m all the way over in India, but if you do ever pop over here, I will be glad to oblige a trip around the city to see the sights and sounds of fair Bangalore, followed by drinks.

Now to get the final bits of my project wrapped up, cheers!

#263004
Jun 15, 2013 at 6:33pm

You are welcome. It just took slightly more effort than I expected because twitter added an application authorization requirement which was not there before. But you should really thank twitter4j and its author, who seems to have kept his java library up to date till now.

#263005
Jan 11, 2014 at 4:32pm

Can anyone confirm if this is still working? I can’t seem to get it to even load up on max 6 windows 8.1

A blank max window opens up and the patcher does not load.

#278036
Jan 28, 2014 at 9:17am

Hmm, doesnt seem to be working for me. Here’s what’s in the Max window:

java.lang.IllegalStateException: Authentication credentials are missing. See http://twitter4j.org/configuration.html for the detail.
at twitter4j.TwitterBaseImpl.ensureAuthorizationEnabled(TwitterBaseImpl.java:200)
at twitter4j.TwitterImpl.get(TwitterImpl.java:1833)
at twitter4j.TwitterImpl.search(TwitterImpl.java:282)
at searchtweet.search(searchtweet.java:38)
java.lang.IllegalStateException: Authentication credentials are missing. See http://twitter4j.org/configuration.html for the detail.
at twitter4j.TwitterBaseImpl.ensureAuthorizationEnabled(TwitterBaseImpl.java:200)
at twitter4j.TwitterImpl.get(TwitterImpl.java:1833)
at twitter4j.TwitterImpl.search(TwitterImpl.java:282)
at searchtweet.search(searchtweet.java:38)
java.lang.IllegalStateException: Authentication credentials are missing. See http://twitter4j.org/configuration.html for the detail.
at twitter4j.TwitterBaseImpl.ensureAuthorizationEnabled(TwitterBaseImpl.java:200)
at twitter4j.TwitterImpl.get(TwitterImpl.java:1833)
at twitter4j.TwitterImpl.search(TwitterImpl.java:282)
at searchtweet.search(searchtweet.java:38)

#279361
Feb 2, 2014 at 12:47pm

Yeah something must have changed with the API, it’s not working for me anymore either. It’s a shame, I was really hoping to utilize it in my thesis project for school.

#279888
Feb 26, 2014 at 8:11am

Try downloading the latest version of Twitter4J (http://twitter4j.org/en/index.html) and replace the old by the new in your java folder, it works again for me !

#282145
Feb 26, 2014 at 5:05pm

Is this still working? I keep getting an error in my max window even after changing the Twitter4J java files to the new ones.

#282268
Feb 27, 2014 at 2:22am

It’s working for me but indeed you have some warnings from log4j the first time you run it.

#282295
Mar 21, 2014 at 7:39pm

Just updated the pack with the new twit4j libraries. Tested in Max5 and seems to be working fine again. NNMAR what are the error messages you are getting?

#284560
Mar 23, 2014 at 1:17pm

Hi Gokce, thanks for your work on this. I get a ‘Could not load class ‘searchtweet’ -error. Is there suppose to be a searchtweet.class in the zip file? You have it in the maxobjects download, but i guess that is the old one that doesn’t work anymore? Thanks again.

#284700
Mar 23, 2014 at 2:45pm

Thanks GOKCE, when I do the first search, I get log4j:WARN No appenders could be found for logger (twitter4j.internal.http.HttpClientlmpl)

Then it goes on with Please initialize the log4j system properly and see the logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

#284704
Apr 1, 2014 at 5:26am

The readme says “copy the searchtweet.class under [maxmsp]/Cycling ’74/java/classes folder”… there is no searchtweet.class file included in the current zip file?

#285406
Apr 1, 2014 at 12:13pm

Thanks Matthew, I must have erased the class file accidentally while rushing the update. Now all files are back in place.

#285434
Apr 1, 2014 at 1:07pm

Works great now, thanks!

#285438
Apr 1, 2014 at 6:05pm

Thank you for the update!

#285452

You must be logged in to reply to this topic.