Social Web: Where are the Semantics?
ESWC 2014
Miriam Fernández, Victor Rodríguez,
Andrés García-Silva, Oscar Corcho
Ontol...
OAuth
• Twitter needs authentication
• Many SNS rely on OAuth to grant access to API features
• OAuth is a security protoc...
Twitter API
• General ideas
– Limit on the requests, in a per 15-min basis
– Each Tweet as an ID
– Objets: Tweets, Users, ...
1.- Obtain a Twitter account, register application
ESWC 2014 Social Web: Where are the Semantics? 4
1. Register a new Twit...
2. – Obtain your credentials
4. See your API keys and generate a token
ESWC 2014 Social Web: Where are the Semantics? 5
To set up your project…you need two files
• TwitterDataCollector.java contains the code that you need to use
the Twitter R...
TwitterDataCollector
• You can find the code:
– In the code folder of the given USB
– https://gist.github.com/vroddon/9d5a...
Sample output
• Hint: use http://jsonviewer.stack.hu/ to see the JSON
ESWC 2014 Social Web: Where are the Semantics? 8
Sample output (II)
ESWC 2014 Social Web: Where are the Semantics? 9
Upcoming SlideShare
Loading in...5
×

ESWC 2014 Tutorial Handson 1: Collect Data from Twitter

118

Published on

ESWC 2014 Tutorial Handson 1: Collect Data from Twitter
http://tutorials.oeg-upm.net/socialweb/snippets-handson1.html

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
118
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

ESWC 2014 Tutorial Handson 1: Collect Data from Twitter

  1. 1. Social Web: Where are the Semantics? ESWC 2014 Miriam Fernández, Victor Rodríguez, Andrés García-Silva, Oscar Corcho Ontology Engineering Group, UPM, Spain Knowledge Media Institute, The Open University
  2. 2. OAuth • Twitter needs authentication • Many SNS rely on OAuth to grant access to API features • OAuth is a security protocol for Web applications. – Security for REST and XML-RPC services. – Signed HTTP Requests – Safe, Password-less Token Exchange • Actors: User / ServiceProvider / Consumer ESWC 2014 Social Web: Where are the Semantics? 2
  3. 3. Twitter API • General ideas – Limit on the requests, in a per 15-min basis – Each Tweet as an ID – Objets: Tweets, Users, Entities (hashtags, photos, urls…), Places • Capabilities – Timelines (of user mentions, retweets, etc.) – Tweets (given ID, retweet, etc.) – Search (shown this in this tutorial) – Friends & Followers, Direct Messages, Favourites, Trends…. – Places & Geo – Users – Streaming (the most powerful!) ESWC 2014 Social Web: Where are the Semantics? 3
  4. 4. 1.- Obtain a Twitter account, register application ESWC 2014 Social Web: Where are the Semantics? 4 1. Register a new Twitter account (or use yours) 2. Register as a developer: https://dev.twitter.com/ 3. Register your new application
  5. 5. 2. – Obtain your credentials 4. See your API keys and generate a token ESWC 2014 Social Web: Where are the Semantics? 5
  6. 6. To set up your project…you need two files • TwitterDataCollector.java contains the code that you need to use the Twitter REST API • twitterCollector.properties. This is the properties file that you need to set up. You need to add: – consumerKey = (the data obtained in the step before) – consumerSecret = (the data obtained in the step before) – accessToken = (the data obtained in the step before) – accessTokenSecret = (the data obtained in the step before) ESWC 2014 Social Web: Where are the Semantics? 6
  7. 7. TwitterDataCollector • You can find the code: – In the code folder of the given USB – https://gist.github.com/vroddon/9d5aac253afaa14c9471 • Open a command line window • Test 1 – java -jar TwitterDataCollector.jar – And you will have searched for tweets containing the word "#eswc2014" • Test 2 – java -jar TwitterDataCollector.jar twitterCollector.properties #obama – And you will have used the given properties file looking for the hashtag #obama • Output: a list of JSONs with Tweet info, one tweet per line ESWC 2014 Social Web: Where are the Semantics? 7
  8. 8. Sample output • Hint: use http://jsonviewer.stack.hu/ to see the JSON ESWC 2014 Social Web: Where are the Semantics? 8
  9. 9. Sample output (II) ESWC 2014 Social Web: Where are the Semantics? 9

×