Skip to content

IBMPredictiveAnalytics/Import_Data_from_Twitter

 
 

Repository files navigation

Discover The New Palette of SPSS Modeler Twitter Nodes

  • Twitter Trends: So what's going on right now at a specific location or worldwide.
  • Twitter Search: Search twitter for a specific keyword.
  • Twitter Users: Get all details about users who tweeted about a keyword.
  • Twitter Timelines: Get all tweets of a list of users.

Quickstart

  1. You need 4 twitter access tokens for all request. If you don't have them already, read this tutorial.

  2. Download and install the Twitter.mpe file in SPSS Modeler or search for 'Twitter' in the Predictive Extensions Hub (klick here for detailed instructions).

  3. Download the example stream to get started.

How to Get a Twitter Access Tokens – Step by Step Tutorial

You need these access tokens to obtain data from Twitter by using the Twitter nodes.

The witter access tokens consist of four different alpha-numeric keys: API Key, API Secret, Access Token and Access Secret. They can be quickly generated, however you might run into issues while developing your stream. That is due to restrictions Twitter has to not abuse their API. Should you run into errors give this a read. You can find a table of all rate limits here.

  1. Go to https://twitter.com/apps/new

  2. Log in with your Twitter credentials.
    Facebook will ask you first to register as a developer if you haven't already done it. Therefore they want your phone number. Klick on your profile picture on the twitter home page, then 'Settings' and then 'Mobile'. Enter your phone number here and proceed with the steps.

  3. Enter an App name, a description, a website (mandatory field, but does not have to be an actual website. Use for example http://local.host), accept the developer agreement and click on 'Create your Twitter application'

  4. Click on 'Keys and Access Tokens'

  5. Scroll down on this page and select 'Create my access token'

  6. Now the page shows all four keys you need. The API Key, API Secret, Access Token and Access Secret. Copy them all and save them somewhere.

Congrats with these keys you now can send Twitter API requests

Requirements

  • R version that suits your SPSS Modeler version (Min. v2.15.2; does not matter on Mac OS)
  • SPSS Modeler v18.0 or later
  • SPSS Modeler ‘R essentials’ plugin

Installation

In SPSS Modeler Click on 'Extensions' --> 'Install Local Extenstions Bundle...' and navigate to the Twitter.mpe file in this folder.
or...
In SPSS Modeler Click on 'Extensions' --> 'Extensions Hub...', search, 'Facebook Posts' and click 'Install...'.

R packages used

TwitteR: http://geoffjentry.hexdump.org/twitteR.pdf