Categories

Versions

You are viewing the RapidMiner Studio documentation for version 9.0 -Check here for latest version

Using the Twitter Connector

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:

The Twitter Connector uses an authentication mechanism calledOAuth 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

  1. Create a new processNew Process Iconin RapidMiner Studio, drag theSearch Twitteroperator into theProcessview, and click on the operator. Click theTwitter iconTwitter icon in theParametersview to open theManage Connectionsdialog. You can also open theManage Connections窗口Tools > Manage Connections.

  2. Click onAdd connectionAdd Connection Iconin the lower left of the window, give a name to the new connection, and setConnection typetoTwitter iconTwitter Connection:

  3. Click onCreate IconCreateand select your new Twitter connection.

  4. To the right of theaccess tokenfield, click theId Iconbutton to request an access token.

  5. Click onRequest access tokenWebsite Iconto 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 onShow URL instead.

  6. Allow RapidMiner to access your Twitter account by clicking onAuthorize app:

  7. 复制访问令牌上显示下一个页面:

  8. Return to RapidMiner Studio, enter the access token, and clickComplete IconComplete:

  9. While not required, we recommend testing your new Twitter connection by clicking theConnection Test IconTestbutton at the bottom of theManage Connectionswindow:

    If the test fails, check whether you copied the complete access token.

  10. Close theManage Connectionsdialog by clicking onSave Icon保存所有更改.

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 theSearch Twitteroperator you can find all tweets containing a specified phrase, along with those tweets` metadata.

  1. Click on theSearch Twitteroperator in theProcessview.

  2. Select your Twitter connection from theconnectiondrop down menu in the operator parameters and fill in thequeryfield. The query is the phrase you will search Twitter for.

  3. RunRun Processthe 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 theGet Twitter User Statusesoperator you can view all tweets from a specified user.

  1. Click on theGet Twitter User Statusesoperator, select your Twitter connection 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 thequery typetoidand input the user ID number.

  2. RunRun Processthe process and view the results:

Get account details of a Twitter user

TheGet Twitter User Detailsoperator can be used to find profile information for a specified username.

  1. Click on theGet Twitter User Detailsoperator, select your Twitter connection in the operator parameters, and specify the user by username or ID number:

  2. RunRun Processthe 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

TheGet Twitter Relationsoperator can be used to obtain a list of all friends or followers of a user.

  1. Click on theGet Twitter Relationsoperator, select your Twitter connection in the operator parameters and specify the user by username or ID number:

  2. RunRun Processthe 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 theGet Twitter User Detailsoperator fromearlier哟,u could use these ID numbers to get account details for the list of followers, too!