Groovy for Domain-specific Languages - Second Edition

(nextflipdebug2) #1
Chapter 6

[ 121 ]

Amid this cacophony of tweets, you might see comments from glaforge, the
Groovy project manager. We might also see comments from Graeme Rocher in this
list depending on when we run the script. Graeme is the creator of the Grails project.
We might be interested in seeing what Graeme is saying about Grails right now. We
can then modify our query to search for messages just from Graeme about Groovy
and Grails as follows:


// Create a query for tweets containing the terms
// "Groovy" and "Grails"
Query query = new Query("from:graemerocher Groovy Grails")

Running the search script with this query would have resulted in an output that
contained the following comment among the tweets:


graemerocher : RT @springsource: @glaforge , @graemerocher and @cdupuis
are presenting at this week's #Groovy and #Grails eXchange http://bit.
ly/6Otsf ...


The @glaforge notation means graemerocher is referencing Guillaume in his
comments. It's always interesting to hear what these guys are talking about,
especially when they reference each other. We can search for tweets from Guillaume
referencing Graeme by using the query string from:glaforge @graemerocher, and
so on.


I've just touched upon some of the search capabilities of the Twitter APIs. The APIs
allow you to use all of the same search operators that you can use in the Twitter
Search box on the web application at https://twitter.com/search-home. The full
list of search operators that can be used are listed at https://dev.twitter.com/
rest/public/search.


Following

The fundamental feature of Twitter is the concept of following and having followers.
You can tweet away on Twitter to your heart's content, but if no one is following
your tweets, you will not be heard. When you follow someone, your Twitter client
will pick up their latest tweets and display them for you. If they follow you, then
your tweets will be listed in their Twitter client when they view it. The Twitter web
application has two lists: for those "following" and your "followers". Confused?

Free download pdf