SHOWCASE: 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.

Twitter Scraper

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

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)


## Ref:

Facebook Scraper

  1. Sign up for Facebook API at 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

# Create Facebook App > Add Platform = Web > URL = http://localhost:1410/

# Use page name or get id from
facebook_name = “singaporeair”

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


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

# Ref:

More Project Showcase

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

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