mirror of
git://git.psyced.org/git/psyced
synced 2024-08-15 03:25:10 +00:00
33 lines
1 KiB
C
33 lines
1 KiB
C
/* twitter client
|
|
*
|
|
* - register @ http://twitter.com/apps
|
|
* - settings:
|
|
* - name: e.g. psyc://your.host/
|
|
* - app type: browser
|
|
* - callback url: http://your.host/oauth
|
|
* - access type: read/write
|
|
* - then in local.h #define TWITTER_KEY & TWITTER_SECRET
|
|
*/
|
|
#include <net.h>
|
|
|
|
inherit NET_PATH "http/oauth";
|
|
|
|
object load(object usr, string key, string secret, string request, string access, string authorize) {
|
|
consumer_key = TWITTER_KEY;
|
|
consumer_secret = TWITTER_SECRET;
|
|
request_token_url = "http://twitter.com/oauth/request_token";
|
|
access_token_url = "http://twitter.com/oauth/access_token";
|
|
authorize_url = "http://twitter.com/oauth/authorize";
|
|
|
|
return ::load(usr, key, secret, request, access, authorize);
|
|
}
|
|
|
|
void parse_home(string body, string headers) {
|
|
P3(("twitter/client:parse_home(%O, %O)\n", body, headers))
|
|
}
|
|
|
|
void home() {
|
|
object ua = clone_object(NET_PATH "http/fetch");
|
|
ua->content(#'parse_home, 1, 1); //');
|
|
fetch(ua, "http://api.twitter.com/1/statuses/home_timeline.json");
|
|
}
|