Created
November 9, 2014 21:01
-
-
Save Craigson/7173775644387006fb16 to your computer and use it in GitHub Desktop.
Temboo library for twitter - trying to get a JSONArray
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //statuses > text (location for text of status) | |
| //statuses > entities > hashtags > text (location of the hashtags it contains) | |
| //statuses > user > screen_name (location of the user name) | |
| //import x-number of tweets from twitter | |
| //store each tweet as an object | |
| //create particle for each tweet | |
| //store user ID | |
| //store location | |
| //store date | |
| //store additional hashtags | |
| import com.temboo.core.*; | |
| import com.temboo.Library.Twitter.Search.*; | |
| // Create a session using your Temboo account application details | |
| TembooSession session = new TembooSession("craigson", "myFirstApp", "2af0bff0408b47198025f032c4eba9d5"); | |
| void setup() { | |
| // Run the Tweets Choreo function | |
| runTweetsChoreo(); | |
| } | |
| void runTweetsChoreo() { | |
| JSONObject json; | |
| json = new JSONObject(); | |
| // Create the Choreo object using your Temboo session | |
| Tweets tweetsChoreo = new Tweets(session); | |
| // Set inputs | |
| tweetsChoreo.setCount("5"); | |
| tweetsChoreo.setAccessToken("2891711796-PlDTEVANONl3gWTcUOPXQyEXfszF0lG9LHkMWbx"); | |
| tweetsChoreo.setQuery("#ebola"); | |
| tweetsChoreo.setAccessTokenSecret("RQEizZxTQgtqkrcMYr6nCFiUsAr6bxbG4zMorOmMqTOfa"); | |
| tweetsChoreo.setConsumerSecret("zqXKdn6xRsXc3WQPsMo9cXn2tZvxswdB4V0llLu3tvGvqtyMlJ"); | |
| tweetsChoreo.setLanguage("en"); | |
| tweetsChoreo.setConsumerKey("LSbb1STZ6ERxZOWIjv2C7CBRW"); | |
| tweetsChoreo.setResultType("recent"); | |
| // Run the Choreo and store the results | |
| TweetsResultSet tweetsResults = tweetsChoreo.run(); | |
| String importedData = tweetsResults.getResponse(); | |
| saveStrings(importedData, "data/results.json"); | |
| // JSONArray importedData; | |
| println(tweetsResults); | |
| //println(importedData); | |
| // Print results | |
| // println(tweetsResults.getResponse()); | |
| // println(tweetsResults.getLimit()); | |
| // println(tweetsResults.getRemaining()); | |
| // println(tweetsResults.getReset()); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment