On Wednesday, 14 January 2015 at 10:45:17 UTC, Ola Fosheim Grøstad wrote:
«twitcurl is a pure C++ library for twitter APIs. twitcurl uses cURL for handling HTTP requests and responses.»

I feel like I say this all the time.... but there's a twitter bit hidden in my misc. D modules, in oauth.d

https://github.com/adamdruppe/arsd/blob/master/oauth.d#L320

Call it:

tweet(twitter(apiKey, apiSecret), userToken, userSecret, "tweet message");

You can get the four tokens on dev.twitter.com, create an app then create your own access token. Plug them in and call the function:

https://twitter.com/adamdruppe/status/555738599069868033

It depends on curl.d, sha.d, and cgi.d from my repo.


You can also use oauth.d to retrieve tweets - use the tokens it provides for a call to curlOauth to the api function, then parse it with something like dom.d or jsvar.d (I think it gives XML but they might have changed that in the last year since I used it) and authorize users. Authorization is a bit tricky:

https://github.com/adamdruppe/arsd/blob/master/oauth.d#L343

and I don't have an example written up for them (I do, but it is in my closed source work projects so I'd have to clean it up before posting in public, I can do it later if you're interested), but you have to call step one, then step two when you get the answer to that. It will return the tokens. It assumes you're a web app using my cgi.d.

Reply via email to