SHOWCASE: Twitter & Facebook Scraper

Standard

Using Twitter and Facebook API, we could extract information from Twitter easily, this project is to use R programming to extract the information from Twitter and Facebook – especially from Public Profile.

Twitter Scraper

  1. Sign up for Twitter API at https://apps.twitter.com/ and create an app
  2. Jot down ‘Key & Access Tokens’ Information
  3. Using the ROAuth / twitteR to obtain the information

library(ROAuth)
library(twitteR)
my_oauth consumer_key = “xxx”,
consumer_secret =”xxx”,
access_token = “xxx”,
access_secret = “xxx”)
#Specify KW and Search
tweets_search = searchTwitter(“Sherlock”, n=100)
#Convert to DF
tweets_df = twListToDF(tweets_search)

write.csv(tweets_df,”test.csv”)

## Ref: https://cran.r-project.org/web/packages/twitteR/twitteR.pdf

Facebook Scraper

  1. Sign up for Facebook API at https://developers.facebook.com/ and create an app
  2. Set website URL for the app (in basic setting) to ‘http://localhost:1410/’
  3. Jot down ‘App ID’ and ‘Secret’
  4. Using the Rfacebook to obtain the information

library(Rfacebook)
# OAUTH
# Create Facebook App > Add Platform = Web > URL = http://localhost:1410/
fb_oauth

# Use page name or get id from http://findmyfbid.com/
facebook_name = “singaporeair”

pagedat = getPage(facebook_name, token=fb_oauth, feed=T, n=200, since = “2016-12-01″)

write.csv(pagedat,”PagePost.csv”)

# get comments in specific post
postment = getPost(pagedat$id[1], token = fb_oauth)$comments

# Ref: https://cran.r-project.org/web/packages/Rfacebook/Rfacebook.pdf

More Project Showcase

If you would like to establish projects similar to above, please feel free to contact me.

gmailp.kanokkorn@gmail.com
linkedinKanokkorn Prasongthanakit

The rest of this blog (except the showcases above) was written in Thai as I intended this to be a personal journal.

Project Showcase

Standard

This page showed the summary past projects I have worked on during my Master’s Degree at SMU MITB.  Please feel free to explore and click on each project to get more detail about the project.

1 E-commerce Dashboard

e-commerce dashboard.JPG

This is a ‘proof-of-concept’ how we can utilize R and Shiny to create an e-commerce website dashboard. The data was static but it is possible to use real-time connection with various platforms such as SQL, Google Analytics, Facebook, etc. (More info)

2 Twitter & Facebook Scraper

Using Twitter and Facebook API, we could extract information from Twitter easily, this project is to use R programming to extract the information from Twitter and Facebook – especially from Public Profile. (More info)

If you would like to establish projects similar to above, please feel free to contact me.

gmailp.kanokkorn@gmail.com
linkedinKanokkorn Prasongthanakit

The rest of this blog (except the showcases above) was written in Thai as I intended this to be a personal journal.