Twitter api
-
Upload
kaleem-malick -
Category
Software
-
view
389 -
download
2
Transcript of Twitter api
Twitter APIM.kaleem
Taussef ahmedZeehan ahmed
M.Haroon
• More than 140 million active users publish over 400 million 140-character “Tweets” every day.• These Tweets are available to researchers
and practitioners through public APIs at no cost.
What is twitter API?• Twitter allows you to interact with its data tweets &
several attributes about tweets using Twitter APIs. • Twitter APIs can be accessed only via authenticated
requests.• Access to Twitter APIs is also limited to a specific
number of requests within a time window called the rate limit. • These limits are applied both at individual user
level as well as at the application level.
What is it’s pre req learning
You need to know • server side scripting language( like php,
python or ruby) • JSON.
How it work?• Server side scripting
languages(php,python or ruby) make requests to twitter API and results would be in JSON format that can be easily read by your program
Introduction to Open Authentication (OAuth)
Twitter uses OAuth to provide authorized access to its API.There is no Security issue
REST API• The REST API is used by many applications to do things like post
Tweets, follow someone, create lists and more.• These APIs use the pull strategy for data retrieval.• To collect information a user must explicitly request it.• we can access a user’s Tweets by using statuses/user timeline from
the REST APIs• Using this API, one can retrieve 3,200 of the most recent Tweet
published by a user including retweets.• The API returns Twitter “Tweet” objects.
REST API
• Twitter provides the search/tweets API to facilitate searching the Tweets. The search API takes words as queries and multiple queries can be combined as a comma separated list. Tweets from the previous 10 day can be searched using this API. • Requests to the API can be made using the method
GetSearchResults . Input to the function is a keyword or a list of keywords in the form of an query. The function returns an array of Tweet objects.
SEARCH API• The Search API is for performing
searches, just as you would onTwitter.com.
STREAM API• The Streaming API is for application developers who want to receive a real-
time stream of the public Tweets on Twitter.• This API provides a constant stream of public
Tweets published by a user.• Streaming api is limited to 400 keywords to track.• Twitter's stream API is that it's essentially a long-running request that's left
open, data is pushed into it as and when it becomes available.• Using the method CreateStreamingConnection
we can create a POST request to the API andfetch the search results as a stream.
• These APIs use the push strategy for data retrieval. Once a request for information is made, the Streaming APIs provide a continuous stream of updates with no further input from the user.
• The parameters are added to the requestby reading through a list of userids using the method CreateRequestBody,
Stream API
Streaming • Using the Streaming API, we can search for
keywords, hashtags, userids,and geographic bounding boxes simultaneously.• It continuous stream of Tweets matching the
search criteria. POST method is preferred while creating this request because when using the GET method to retrieve the results, long URLs might be truncated.
Streaming APIs
Streaming APIs limit the number of parameters which canbe supplied in one request. Up to 400 keywords, 25 geographic bounding boxes and 5,000 userids can be provided in one request.
identify the location of a Tweet
• Location information on Twitter is available from two different sources• Geotagging information: Users can optionally
choose to provide location information for the Tweets they publish. This information can be highly accurate if the Tweet was published using a smartphone with GPS capabilities.• Profile of the user: User location can be extracted from the location fieldin the user’s profile. The information in the location field itself can be extracted using the APIs
Obtaining Data via Resellers
• The rate limitations of Twitter APIs can be too restrictive for certain types of applications.
• To satisfy such requirements, Twitter Firehose provides accessto 100% of the public Tweets on Twitter at a price.
• Firehose data can bepurchased through third party resellers of Twitter data.
• There are three resellers of data, each of which provide differentlevels of access.
• In addition to Twitter data some of them also provide datafrom other social media platforms, which might be useful while building social media based systems.
• These include the following:• DataSiftTM 12 - provides access to past data as well as streaming data• GNIPTM 13- provides access to streaming data only• TopsyTM 14 - provides access to past data only
ThE ENd