How do interact with the Twitter API using Mathematica? SocialMediaData is a lovely function, but appears to be severely limited in what it can draw from Twitter. For example, if I want to get a list of retweets of a Tweet I've sent there's an API call for this but not a means of doing so through SocialMediaData. How do I augment the function with all the API has to offer?
Asked
Active
Viewed 1,667 times
1 Answers
9
The Twitter API now requires Oauth 1.0a authentication, so Ragfield's Twitter.m won't work without modification. While I haven't solved the problem for Twitter's API, I have solved two similar authentication problems from Mathematica. You can see what I did here:
Can anyone explain how to use Mathematica's OAuth package?
UPDATE:
I just tried it with Twitter and this seemed to work:
token = HTTPClient`OAuthAuthentication[
"ConsumerKey" -> "your_api_key",
"ConsumerSecret" -> "your_api_secret",
"RequestEndpoint" -> "https://api.twitter.com/oauth/request_token",
"AuthorizeEndpoint" -> "https://api.twitter.com/oauth/authorize",
"AccessEndpoint" -> "https://api.twitter.com/oauth/access_token"];
url = "https://api.twitter.com/1.1/statuses/retweets_of_me.json";
URLFetch[url, "OAuthAuthentication" -> token]
I don't really know for sure since I don't have any retweets.
HTTPClient\OAuthAuthentication`? – hailekofi May 03 '13 at 15:33
– Max May 06 '13 at 02:05HTTPClient`OAuthToken[HTTPClient`OAuth`Private`OAuth10Parameters[ "api.fitbit.com", None, Automatic, "verifier", Automatic, Automatic, $FitbitConsumerKey, $FitbitConsumerSecret, "https://api.fitbit.com/oauth/request_token", "GET", "https://www.fitbit.com/oauth/authorize", "RemoveWhitespace", "https://api.fitbit.com/oauth/access_token", "GET", "HMAC-Sha1", "HMAC", "oob", "Text/1.0", "Text/1.0", None], HTTPClient`OAuth`Private`Token10[ $FitbitUserKey, $FitbitUserSecret]]URLFetch[url,{"Content","Headers"}, "OAuthAuthentication" -> token]doesn't do the job... – hailekofi Jun 04 '13 at 17:25