Sorry for the delay on this, but here's an example of using the Java objects
directly:
<!--- create instances of the twitter and query objects --->
<cfset t = CreateObject("java",
"twitter4j.TwitterFactory").getInstance("user", "password") />
<cfset q = CreateObject("java", "twitter4j.Query").init("glayvin") />
<!--- set results per page on the query object to 100 --->
<cfset q.rpp(100) />
<!--- arrays to hold the search results as both JSON strings
and twitter4j Tweet objects --->
<cfset jsonResults = [] />
<cfset tweetResults = [] />
<!--- Max search results returned will be 1500, so with 100 per page, loop
over and
search 15 times, incrementing the page each time. The results will
contain
warning='null' if no results were returned, so could check for that
in the
loop, not append, and break when that happens. Not doing that here.
--->
<cfloop index="i" from="1" to="15">
<!--- this increments the search results page --->
<cfset q.setPage(i) />
<!--- append JSON string to the json results array --->
<cfset ArrayAppend(jsonResults, t.search(q).toString()) />
<!--- get Tweet objects from same search and page --->
<cfset tweets = t.search(q).getTweets() />
<!--- loop over tweets and append to array --->
<cfset iter = tweets.iterator() />
<cfloop condition="#iter.hasNext()#">
<cfset ArrayAppend(tweetResults, iter.next())>
</cfloop>
</cfloop>
<!--- dump arrays so we can see what we got --->
<cfdump var="#jsonResults#" />
<cfdump var="#tweetResults#" />
<!--- example of looping over the tweet results and getting user and text of
the tweet;
see http://twitter4j.org/en/javadoc-latest/twitter4j/Tweet.html for
all
the methods available on the Tweet class --->
<table border="1">
<tr>
<th>User</th>
<th>Tweet</th>
</tr>
<cfloop index="tweet" array="#tweetResults#">
<cfoutput>
<tr>
<td>#tweet.getFromUser()#</td>
<td>#tweet.getText()#</td>
</tr>
</cfoutput>
</cfloop>
</table>
--
Matthew Woodward
[email protected]
http://blog.mattwoodward.com
identi.ca / Twitter: @mpwoodward
Please do not send me proprietary file formats such as Word, PowerPoint,
etc. as attachments.
http://www.gnu.org/philosophy/no-word-attachments.html
--
Open BlueDragon Public Mailing List
http://www.openbluedragon.org/ http://twitter.com/OpenBlueDragon
official manual: http://www.openbluedragon.org/manual/
Ready2Run CFML http://www.openbluedragon.org/openbdjam/
mailing list - http://groups.google.com/group/openbd?hl=en