1 / 11

R Programming

R Programming. Social Media Mining Module: Accessing an API. Social Media Mining Module. Accessing an API Extracting Data Cleaning and PreProcessing Data Modeling Frequency analysis Clustering Segmentations Result Visualizations. SMMM: Accessing an API.

anthonyh
Download Presentation

R Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. R Programming Social Media Mining Module: Accessing an API

  2. Social Media Mining Module • Accessing an API • Extracting Data • Cleaning and PreProcessing • Data Modeling • Frequency analysis • Clustering • Segmentations • Result Visualizations

  3. SMMM: Accessing an API API = Application Program(ming) Interface An application program interface (API) is code that allows two software programs to communicate with each other.

  4. SMMM: Accessing the Twitter API STEP 1: Create a Twitter account STEP 2: Install a bunch of packages (see code). STEP 3: Go to: https://apps.twitter.com/app/new

  5. SMMM: Accessing the Twitter API

  6. SMMM: Accessing the Twitter API STEP 4: Obtain your keys and your tokens. You will need four pieces of information to connect to the Twitter API – • Customer API Key • Customer API Secret • Access Token • Token Secret Note that these are UNIQUE to you and TEMPORARY.

  7. SMMM: Accessing the Twitter API

  8. SMMM: Accessing the Twitter API

  9. SMMM: Accessing the Twitter API STEP 5: Establish the connection and then create the “handshake”. reqURL <- "https://api.twitter.com/oauth/request_token" accessURL <- "https://api.twitter.com/oauth/access_token" authURL <- "https://api.twitter.com/oauth/authorize" twitCred <- OAuthFactory$new (consumerKey=consumerKey, consumerSecret=consumerSecret, requestURL=reqURL, accessURL=accessURL,authURL=authURL) twitCred$handshake(cainfo = system.file("CurlSSL","cacert.pem", package = "RCurl")) STEP 6: The “handshake” will generate a unique PIN that you will have to paste into your console.

  10. SMMM: Accessing the Twitter API

  11. SMMM: Accessing an API Once you establish the handshake, you are ready to start scraping! You can scrape “real time” using FilterStream or you can scrape retroactively using SearchTwitter.

More Related