SlideShare a Scribd company logo
Harvesting Data from
Twitter: Hands on
Experience
Dr. Nora alTwairesh, Ms. Tarfa alBuhairi, Ms. Mawaheb
alTuwaijri, and Ms. Afnan alMoammar
Content
• Introduction about Twitter API
• Some ready to use tools (no programming)
• Comparison between R and Python
• R
• Python
WHY TWITTER?!
Why Twitter
• Twitter has become a mass information hub that can be
used to study the evolution of any issue matter:
revolutionary machine
• Research disciplines that study Twitter data spanned
the domains of computer science, information science,
communications, business, economics, education,
medicine, political science, and sociology.
• Recent studies show that %60 of daily Arabic tweets
are from Saudi Arabia.
Why Twitter
Hamdy Mubarak and Kareem Darwish. 2014. Using Twitter to collect a multi-dialectal corpus of Arabic. ANLP 2014:1.
Twitter API
• Free access to the tweets posted in the last 7 days within a certain
rate-limit.
• Any tweets posted earlier than 7 days are considered historical
tweets and should be purchased through third party providers
• The Twitter API provides three interfaces for tweet collection:
Streaming API, REST API and Search API
Streaming API
• The Streaming API provides real-time tweets in a live-poll fashion.
• In a Streaming API, requested tweets will be constantly flowing as
they are posted on Twitter. It is delivered in three bandwidths:
“spritzer” :1%, “gardenhose”: 10% and “firehose”: 100% of all
tweets posted on Twitter.
• A regular user wanting to collect tweets will be granted spritzer
access.
REST API
• The REST API was specifically designed for programmatic access
to read and write Twitter data.
• Third party applications that interact with Twitter are provided with
a large set of methods in the REST API to develop these
applications.
• The access of the REST API is also rate-limited, the limit is 150
requests per hour.
Search API
• Similar to the REST API, the Search API is pull-based. It replicates
the search functionality provided on the Twitter website. However,
tweets retrieved are restricted to the past 7 days.
• the Search API is not appropriate for high-throughput real-time data
acquisition. As such Twitter Inc. discourages its use and plans to
discontinue it in the future.
Create a Twitter App
• To access the Twitter API you need to create a twitter app:
follow this simple tutorial to do so:
https://iag.me/socialmedia/how-to-create-a-twitter-app-in-8-
easy-steps/
• you will use the OAUTH settings in both R and Python:
• Consumer Key
• Consumer Secret
• OAuth Access Token
• OAuth Access Token Secret
Tools to Collect Tweets
• Nodexl: https://nodexl.codeplex.com/
• Tweet Archivist : https://www.tweetarchivist.com/
• Twitter Archiving Google Spreadsheet (TAGS):
https://tags.hawksey.info/
What is R?
•Roos & Robert.
16
Why R?
Statistics
Machine
Learning
Data
Analysis
Why R?
Statistics
Machine
Learning
Data
Analysis Also:
Programming
Language
R allows you to integrate with
Code
Code
C++
Code
Jave
Code
Python
Code
R
Fastest-growing language
https://www.r-bloggers.com/r-is-the-fastest-growing-language-on-stackoverflow/
fastest-growing language
Examples
Now ..
Open your laptop, please

Steps to install R
1: install R:
• https://cran.r-project.org/bin/windows/base/ ---- http://cran.r-
project.org/bin/macosx/
2: install RStudio (after installing R)
• https://www.rstudio.com/products/rstudio/download3/
3: Install these packages (see the user manual):
• streamR/ ROAuth/ RJSONIO/ RTextTools/ e1071/ SparseM.
User manual:
• http://www.devchakraborty.com/RunningRJafroc.pdf
R Packages list:
• https://cran.r-project.org/web/packages/available_packages_by_date.html
Developing Packages with RStudio:
• https://support.rstudio.com/hc/en-
us/articles/200486488?version=0.99.903&mode=desktop
• https://cran.r-project.org/doc/manuals/R-exts.html
Useful URLs
• https://www.r-bloggers.com
• https://www.r-bloggers.com/how-to-learn-r-2/
• http://www.slideshare.net/ChiuYW/r-language-tutorial
• https://www.rwaq.org/courses/introduction-r-
programming
• https://www.researchgate.net/publication/288485806_Hy
brid_Sentiment_Analyser_for_Arabic_Tweets_using_R
Python
• Two versions: 2.7 3.X
• Twitter packages: twitter -- -tweepy
• IDE :Anaconda: iPython notebook: Jupyter
Installing Python
• Install Anaconda from here
• https://www.continuum.io/downloads
choose Python 2.7 version (only for this tutorial)
• Install the twitter package: From the command line
(terminal) type: pip install twitter
Comparison between R and Python
• https://www.datacamp.com/community/tutorials/r-or-python-for-
data-analysis#gs.GuXGfAc
• http://blog.udacity.com/2015/01/python-vs-r-learn-first.html
• http://www.dataschool.io/python-or-r-for-data-science/
Contact Us
ASA Research Group
Twitter: @ASA__IU
Email: asa@imamu.edu.sa
Website: http://asa.imamu.edu.sa/
IWAN Research Group
Twitter: @IWAN_RG
Email: iwan@ksu.edu.sa
Website: http://iwan.ksu.edu.sa
Thank you,
See you later …
THE END ..

More Related Content

Viewers also liked

Semantic Patterns for Sentiment Analysis of Twitter
Semantic Patterns for Sentiment Analysis of TwitterSemantic Patterns for Sentiment Analysis of Twitter
Semantic Patterns for Sentiment Analysis of Twitter
Knowledge Media Institute - The Open University
 
Trend detection and analysis on Twitter
Trend detection and analysis on TwitterTrend detection and analysis on Twitter
Trend detection and analysis on Twitter
Lukas Masuch
 
Sentiment analysis-by-nltk
Sentiment analysis-by-nltkSentiment analysis-by-nltk
Sentiment analysis-by-nltkWei-Ting Kuo
 
How Sentiment Analysis works
How Sentiment Analysis worksHow Sentiment Analysis works
How Sentiment Analysis works
CJ Jenkins
 
Introduction to Sentiment Analysis
Introduction to Sentiment AnalysisIntroduction to Sentiment Analysis
Introduction to Sentiment Analysis
Jaganadh Gopinadhan
 
Twitter analysis by Kaify Rais
Twitter analysis by Kaify RaisTwitter analysis by Kaify Rais
Twitter analysis by Kaify Rais
Ajay Ohri
 
Sentiment analysis of tweets
Sentiment analysis of tweetsSentiment analysis of tweets
Sentiment analysis of tweetsVasu Jain
 
Twitter sentiment-analysis Jiit2013-14
Twitter sentiment-analysis Jiit2013-14Twitter sentiment-analysis Jiit2013-14
Twitter sentiment-analysis Jiit2013-14Rachit Goel
 
Sentiment Analysis in Twitter
Sentiment Analysis in TwitterSentiment Analysis in Twitter
Sentiment Analysis in Twitter
Ayushi Dalmia
 
Sentiment Analysis of Twitter Data
Sentiment Analysis of Twitter DataSentiment Analysis of Twitter Data
Sentiment Analysis of Twitter Data
Sumit Raj
 
Act2 hepn
Act2 hepnAct2 hepn
Act2 hepn
Helen Poot
 
Analisis sinyal syarifudin
Analisis sinyal syarifudinAnalisis sinyal syarifudin
Analisis sinyal syarifudin
Syarifudin86
 
Formasi jabatan kaltara
Formasi jabatan kaltaraFormasi jabatan kaltara
Formasi jabatan kaltara
khairunnisa maharani
 

Viewers also liked (13)

Semantic Patterns for Sentiment Analysis of Twitter
Semantic Patterns for Sentiment Analysis of TwitterSemantic Patterns for Sentiment Analysis of Twitter
Semantic Patterns for Sentiment Analysis of Twitter
 
Trend detection and analysis on Twitter
Trend detection and analysis on TwitterTrend detection and analysis on Twitter
Trend detection and analysis on Twitter
 
Sentiment analysis-by-nltk
Sentiment analysis-by-nltkSentiment analysis-by-nltk
Sentiment analysis-by-nltk
 
How Sentiment Analysis works
How Sentiment Analysis worksHow Sentiment Analysis works
How Sentiment Analysis works
 
Introduction to Sentiment Analysis
Introduction to Sentiment AnalysisIntroduction to Sentiment Analysis
Introduction to Sentiment Analysis
 
Twitter analysis by Kaify Rais
Twitter analysis by Kaify RaisTwitter analysis by Kaify Rais
Twitter analysis by Kaify Rais
 
Sentiment analysis of tweets
Sentiment analysis of tweetsSentiment analysis of tweets
Sentiment analysis of tweets
 
Twitter sentiment-analysis Jiit2013-14
Twitter sentiment-analysis Jiit2013-14Twitter sentiment-analysis Jiit2013-14
Twitter sentiment-analysis Jiit2013-14
 
Sentiment Analysis in Twitter
Sentiment Analysis in TwitterSentiment Analysis in Twitter
Sentiment Analysis in Twitter
 
Sentiment Analysis of Twitter Data
Sentiment Analysis of Twitter DataSentiment Analysis of Twitter Data
Sentiment Analysis of Twitter Data
 
Act2 hepn
Act2 hepnAct2 hepn
Act2 hepn
 
Analisis sinyal syarifudin
Analisis sinyal syarifudinAnalisis sinyal syarifudin
Analisis sinyal syarifudin
 
Formasi jabatan kaltara
Formasi jabatan kaltaraFormasi jabatan kaltara
Formasi jabatan kaltara
 

Similar to Harvesting Data from Twitter Workshop: Hands-on Experience

Twitter api
Twitter apiTwitter api
Twitter api
kaleem malick
 
CSE5656 Complex Networks - Gathering Data from Twitter
CSE5656 Complex Networks - Gathering Data from TwitterCSE5656 Complex Networks - Gathering Data from Twitter
CSE5656 Complex Networks - Gathering Data from Twitter
Marcello Tomasini
 
Sentiment analysis on demonetisation
Sentiment analysis on demonetisationSentiment analysis on demonetisation
Sentiment analysis on demonetisation
AbrarMohamed5
 
Social Media Data
Social Media DataSocial Media Data
Social Media Data
Will Simm
 
STC Summit 2015: API Documentation, an Example-Based Approach
STC Summit 2015: API Documentation, an Example-Based ApproachSTC Summit 2015: API Documentation, an Example-Based Approach
STC Summit 2015: API Documentation, an Example-Based ApproachLois Patterson
 
Twet
TwetTwet
Development of Twitter Application #1 - Overview
Development of Twitter Application #1 - OverviewDevelopment of Twitter Application #1 - Overview
Development of Twitter Application #1 - Overview
Myungjin Lee
 
Data Collection from Social Media Platforms
Data Collection from Social Media PlatformsData Collection from Social Media Platforms
Data Collection from Social Media Platforms
Mahmoud Yasser
 
Rob Procter
Rob ProcterRob Procter
Rob ProcterNSMNSS
 
Webinar: Twitter For Recruiters
Webinar: Twitter For RecruitersWebinar: Twitter For Recruiters
Webinar: Twitter For RecruitersTweetajob
 
Mz twitter-1.1-sdl
Mz twitter-1.1-sdlMz twitter-1.1-sdl
Mz twitter-1.1-sdl
Angus Fox
 
All About Twitter!
All About Twitter!All About Twitter!
All About Twitter!
Robin S. Joseph
 
Twitter: A Hands-On Learning Session for Researcher
Twitter: A Hands-On Learning Session for ResearcherTwitter: A Hands-On Learning Session for Researcher
Twitter: A Hands-On Learning Session for Researcher
KMb Unit, York University
 
Recruitcamp Twitter
Recruitcamp   TwitterRecruitcamp   Twitter
Recruitcamp Twittermarywood123
 
Recruitcamp Twitter
Recruitcamp   TwitterRecruitcamp   Twitter
Recruitcamp Twittermarywood123
 
ReliefWeb's Journey from RSS Feed to Public API
ReliefWeb's Journey from RSS Feed to Public APIReliefWeb's Journey from RSS Feed to Public API
ReliefWeb's Journey from RSS Feed to Public API
Phase2
 
PhishAri: Automatic Realtime Phishing Detection on Twitter
PhishAri: Automatic Realtime Phishing Detection on TwitterPhishAri: Automatic Realtime Phishing Detection on Twitter
PhishAri: Automatic Realtime Phishing Detection on Twitter
Anupama Aggarwal
 
Twitter topic trends
Twitter topic trendsTwitter topic trends
Twitter topic trends
Monika Doshi
 
Collecting Twitter Data
Collecting Twitter DataCollecting Twitter Data
Collecting Twitter Data
Cornelius Puschmann
 

Similar to Harvesting Data from Twitter Workshop: Hands-on Experience (20)

Twitter api
Twitter apiTwitter api
Twitter api
 
CSE5656 Complex Networks - Gathering Data from Twitter
CSE5656 Complex Networks - Gathering Data from TwitterCSE5656 Complex Networks - Gathering Data from Twitter
CSE5656 Complex Networks - Gathering Data from Twitter
 
Sentiment analysis on demonetisation
Sentiment analysis on demonetisationSentiment analysis on demonetisation
Sentiment analysis on demonetisation
 
Social Media Data
Social Media DataSocial Media Data
Social Media Data
 
STC Summit 2015: API Documentation, an Example-Based Approach
STC Summit 2015: API Documentation, an Example-Based ApproachSTC Summit 2015: API Documentation, an Example-Based Approach
STC Summit 2015: API Documentation, an Example-Based Approach
 
Twet
TwetTwet
Twet
 
Development of Twitter Application #1 - Overview
Development of Twitter Application #1 - OverviewDevelopment of Twitter Application #1 - Overview
Development of Twitter Application #1 - Overview
 
Data Collection from Social Media Platforms
Data Collection from Social Media PlatformsData Collection from Social Media Platforms
Data Collection from Social Media Platforms
 
Rob Procter
Rob ProcterRob Procter
Rob Procter
 
Webinar: Twitter For Recruiters
Webinar: Twitter For RecruitersWebinar: Twitter For Recruiters
Webinar: Twitter For Recruiters
 
Mz twitter-1.1-sdl
Mz twitter-1.1-sdlMz twitter-1.1-sdl
Mz twitter-1.1-sdl
 
All About Twitter!
All About Twitter!All About Twitter!
All About Twitter!
 
Twitter: A Hands-On Learning Session for Researcher
Twitter: A Hands-On Learning Session for ResearcherTwitter: A Hands-On Learning Session for Researcher
Twitter: A Hands-On Learning Session for Researcher
 
Recruitcamp Twitter
Recruitcamp   TwitterRecruitcamp   Twitter
Recruitcamp Twitter
 
Recruitcamp Twitter
Recruitcamp   TwitterRecruitcamp   Twitter
Recruitcamp Twitter
 
ReliefWeb's Journey from RSS Feed to Public API
ReliefWeb's Journey from RSS Feed to Public APIReliefWeb's Journey from RSS Feed to Public API
ReliefWeb's Journey from RSS Feed to Public API
 
Slide
SlideSlide
Slide
 
PhishAri: Automatic Realtime Phishing Detection on Twitter
PhishAri: Automatic Realtime Phishing Detection on TwitterPhishAri: Automatic Realtime Phishing Detection on Twitter
PhishAri: Automatic Realtime Phishing Detection on Twitter
 
Twitter topic trends
Twitter topic trendsTwitter topic trends
Twitter topic trends
 
Collecting Twitter Data
Collecting Twitter DataCollecting Twitter Data
Collecting Twitter Data
 

Recently uploaded

How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
CatarinaPereira64715
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
Bhaskar Mitra
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 

Recently uploaded (20)

How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 

Harvesting Data from Twitter Workshop: Hands-on Experience

  • 1. Harvesting Data from Twitter: Hands on Experience Dr. Nora alTwairesh, Ms. Tarfa alBuhairi, Ms. Mawaheb alTuwaijri, and Ms. Afnan alMoammar
  • 2. Content • Introduction about Twitter API • Some ready to use tools (no programming) • Comparison between R and Python • R • Python
  • 4. Why Twitter • Twitter has become a mass information hub that can be used to study the evolution of any issue matter: revolutionary machine • Research disciplines that study Twitter data spanned the domains of computer science, information science, communications, business, economics, education, medicine, political science, and sociology.
  • 5. • Recent studies show that %60 of daily Arabic tweets are from Saudi Arabia. Why Twitter Hamdy Mubarak and Kareem Darwish. 2014. Using Twitter to collect a multi-dialectal corpus of Arabic. ANLP 2014:1.
  • 6. Twitter API • Free access to the tweets posted in the last 7 days within a certain rate-limit. • Any tweets posted earlier than 7 days are considered historical tweets and should be purchased through third party providers • The Twitter API provides three interfaces for tweet collection: Streaming API, REST API and Search API
  • 7. Streaming API • The Streaming API provides real-time tweets in a live-poll fashion. • In a Streaming API, requested tweets will be constantly flowing as they are posted on Twitter. It is delivered in three bandwidths: “spritzer” :1%, “gardenhose”: 10% and “firehose”: 100% of all tweets posted on Twitter. • A regular user wanting to collect tweets will be granted spritzer access.
  • 8. REST API • The REST API was specifically designed for programmatic access to read and write Twitter data. • Third party applications that interact with Twitter are provided with a large set of methods in the REST API to develop these applications. • The access of the REST API is also rate-limited, the limit is 150 requests per hour.
  • 9. Search API • Similar to the REST API, the Search API is pull-based. It replicates the search functionality provided on the Twitter website. However, tweets retrieved are restricted to the past 7 days. • the Search API is not appropriate for high-throughput real-time data acquisition. As such Twitter Inc. discourages its use and plans to discontinue it in the future.
  • 10. Create a Twitter App • To access the Twitter API you need to create a twitter app: follow this simple tutorial to do so: https://iag.me/socialmedia/how-to-create-a-twitter-app-in-8- easy-steps/ • you will use the OAUTH settings in both R and Python: • Consumer Key • Consumer Secret • OAuth Access Token • OAuth Access Token Secret
  • 11. Tools to Collect Tweets • Nodexl: https://nodexl.codeplex.com/ • Tweet Archivist : https://www.tweetarchivist.com/ • Twitter Archiving Google Spreadsheet (TAGS): https://tags.hawksey.info/
  • 12.
  • 13. What is R? •Roos & Robert. 16
  • 16. R allows you to integrate with
  • 21. Now .. Open your laptop, please 
  • 22. Steps to install R 1: install R: • https://cran.r-project.org/bin/windows/base/ ---- http://cran.r- project.org/bin/macosx/ 2: install RStudio (after installing R) • https://www.rstudio.com/products/rstudio/download3/ 3: Install these packages (see the user manual): • streamR/ ROAuth/ RJSONIO/ RTextTools/ e1071/ SparseM. User manual: • http://www.devchakraborty.com/RunningRJafroc.pdf R Packages list: • https://cran.r-project.org/web/packages/available_packages_by_date.html Developing Packages with RStudio: • https://support.rstudio.com/hc/en- us/articles/200486488?version=0.99.903&mode=desktop • https://cran.r-project.org/doc/manuals/R-exts.html
  • 23. Useful URLs • https://www.r-bloggers.com • https://www.r-bloggers.com/how-to-learn-r-2/ • http://www.slideshare.net/ChiuYW/r-language-tutorial • https://www.rwaq.org/courses/introduction-r- programming • https://www.researchgate.net/publication/288485806_Hy brid_Sentiment_Analyser_for_Arabic_Tweets_using_R
  • 24. Python • Two versions: 2.7 3.X • Twitter packages: twitter -- -tweepy • IDE :Anaconda: iPython notebook: Jupyter
  • 25. Installing Python • Install Anaconda from here • https://www.continuum.io/downloads choose Python 2.7 version (only for this tutorial) • Install the twitter package: From the command line (terminal) type: pip install twitter
  • 26. Comparison between R and Python • https://www.datacamp.com/community/tutorials/r-or-python-for- data-analysis#gs.GuXGfAc • http://blog.udacity.com/2015/01/python-vs-r-learn-first.html • http://www.dataschool.io/python-or-r-for-data-science/
  • 27. Contact Us ASA Research Group Twitter: @ASA__IU Email: asa@imamu.edu.sa Website: http://asa.imamu.edu.sa/ IWAN Research Group Twitter: @IWAN_RG Email: iwan@ksu.edu.sa Website: http://iwan.ksu.edu.sa
  • 28. Thank you, See you later … THE END ..

Editor's Notes

  1. Gardenhose access is granted on special request from Twitter Inc. and the firehose access is granted to third-party business partners of Twitter Inc. which are considered third-party data providers.
  2. An example of these applications is the inclusion of a Tweet share button on some websites that allows the reader of this website to share the link of the website on Twitter by posting it as a tweet; this is an example of writing Twitter data. An example of reading Twitter data is when websites display tweets of a certain hashtag or user account in a widget on their website’s pages.
  3. With the Search API you can only sent 180 Requests every 15 min timeframe. With a maximum number of 100 tweets per Request this means you can mine for 4 x 180 x 100 = 72.000 tweets per hour. 
  4. The project was conceived in 1992, with an initial version released in 1994 and a stable beta version in 2000.
  5. R is the leading tool for statistics, data analysis, and machine learning.
  6. R is the leading tool for statistics, data analysis, and machine learning.
  7. R allows you to integrate with other languages (C/C++, Java, Python)