Updated 12 Jul 2013
twitty is a MATLAB class for interaction with the twitter platform via its REST API v1.1.
Here are some examples of its usage:
tw = twitty(credentials); % create a twitty object and supply user credentials.
For details on credentials, type "help twitty" and refer to the sections about PROPERTIES and OBTAINING TWITTER CREDENTIALS.
After setting valid credentials, a twitty object should be able to access the Twitter platform. E.g.:
1. S = tw.search('matlab'); % search twitter.com for messages including the word 'matlab'.
2. S = tw.updateStatus('Hello, Twitter!'); % or twit something cooler.
3. S = tw.sampleStatuses(); % get a continuous stream of a random sample of all public statuses.
4. S = tw.userTimeline('screen_name', 'matlab'); % get recent messages posted by the user 'matlab';
5. S = tw.trendsAvailable(); % get place for which Twitter has trends available.
Conceptually, twitty methods are just wrapper functions around the main function which calls the Twitter API. This API caller function, callTwitterAPI(), does the main job:
creates an HTTPS request, handles the authentication and encoding, sends the request to and parses a response from the Twitter platform. It is not meant to be called directly but should be invoked
from a wrapper function.
The wrapper functions provide an intuitive MATLAB-style interface for accessing the Twitter's API resources. For the complete description of the REST API v1.1, refer to the official
documentation at https://dev.twitter.com/docs/api/1.1.
The API is quite extensive and twitty doesn't cover it all. It includes most of the resources in the following sections: TIMELINES, STREAMING, TWEETS, SEARCH, FRIENDS & FOLLOWERS, USERS, PLACES & GEO, TRENDS, and HELP.
For the summary of the twitty's methods run the 'twitty.API' command.
For information on a particular function, type 'help twitty.<function name>'.
optional - the json parser by Joel Feenstra: http://www.mathworks.co.uk/matlabcentral/fileexchange/20565-json-parser
Vladimir Bondarenko (2023). twitty (https://www.mathworks.com/matlabcentral/fileexchange/34837-twitty), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
- MATLAB > App Building >
- MATLAB > External Language Interfaces >
- MATLAB > External Language Interfaces > Other languages > Twitter >
Inspired by: Update twitter status, JSON Parser
Inspired: Core_twitter: A wrapper for the Python package Tweepy to interface with the Twitter API
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Added auxiliary files: tweetingSummary.m and coastline.mat.
Fixed: error in the constructor call twitty(creds), due to the outdated credentials validity check.
Updated to the Twitter REST API v1.1.
Some documentation updates.