You are viewing the RapidMiner Studio documentation for version 10.0 - Check here for latest version
Using the Twitter Connector
This guide targets the new Connection Management introduced with RapidMiner Studio 9.3.
For the old Legacy Twitter Connections see the 9.2 documentation
The Twitter Connector allows you to easily access Twitter data directly from RapidMiner Studio. The connector can search for phrases, tweets, or user profile information. This document will walk you through how to:
- Connect to your Twitter account
- Search for tweets containing a phrase
- Get tweets from a user
- Get account details of a Twitter user
- Get a list of friends or followers
The Twitter Connector uses an authentication mechanism called OAuth 2.0. Instead of giving RapidMiner your username and password, you generate an access token that can be used by RapidMiner Studio to connect to your Twitter account. This token cannot be used by any other applications and helps keep your Twitter credentials secure.
Connect to your Twitter account
In RapidMiner Studio, right-click on the repository you want to store your Twitter Connection in and choose Create Connection.
You can also click on Connections > Create Connection and select the Repository from the dropdown of the following dialog.
Give a name to the new connection, and set Connection Type to Twitter:
Click on Create and switch to the Setup tab in the Edit connection dialog.
To the right of the Access Token field, click the button to request an access token.
Click on Request access token to open the Twitter website in your browser. If you are not already logged into your Twitter account, you will have to do so now. You can manually copy the URL by clicking on Show URL instead.
Allow RapidMiner to access your Twitter account by clicking on Authorize app:
Copy the access token shown on the next page:
Return to RapidMiner Studio, enter the access token, and click Complete:
While not required, we recommend testing your new Twitter Connection by clicking the Test Connection button at the bottom of the Edit connection window:
If the test fails, check whether you copied the complete access token.
Close the Edit connection dialog by clicking on Save.
You have successfully connected RapidMiner Studio to your Twitter account! The next sections will show you how to use this Connector to search for different types of information from Twitter.
Search for tweets containing a phrase
With the Search Twitter operator you can find all tweets containing a specified phrase, along with those tweets` metadata.
Drag a Search Twitter operator into the Process Panel. Select your Twitter Connection for the connection entry parameter from the Connections folder of the repository you stored it in by clicking on the button next to it:
Alternatively, you can drag the Twitter Connection from the repository into the Process Panel and connect the resulting operator with the Search Twitter operator.
Fill in the query field. The query is the phrase you will search Twitter for.
Run the process and view the results:
As you can see, the results include the user who posted the tweet, the full text of the tweet, and much more!
Get tweets from a user
With the Get Twitter User Statuses operator you can view all tweets from a specified user.
Click on the Get Twitter User Statuses operator, select your Twitter Connection entry in the operator parameters, and specify the username you are interested in. Note you do not need to include the "@"" symbol that usually prefixes Twitter usernames. Alternatively, change the query type to id and input the user ID number.
Run the process and view the results:
Get account details of a Twitter user
The Get Twitter User Details operator can be used to find profile information for a specified username.
Click on the Get Twitter User Details operator, select your Twitter Connection entry in the operator parameters, and specify the user by username or ID number:
Run the process and view the results:
The table contains information such as account creation data and number of followers. To find out more about the user's followers, see the next section.
Get a list of friends or followers
The Get Twitter Relations operator can be used to obtain a list of all friends or followers of a user.
Click on the Get Twitter Relations operator, select your Twitter Connection entry in the operator parameters and specify the user by username or ID number:
Run the process and view the results:
The first column contains the user you specified and the second column shows the ID numbers of their followers. With your knowledge of the Get Twitter User Details operator from earlier, you could use these ID numbers to get account details for the list of followers, too!