Posted the beginnings of it last night. I'll be adding better search
query support soon, but will probably not be adding other functions
until I run into a need for them. The API is written to extract
specific bits of information and frequently does not return every bit
of data included with the response. I haven't bothered with
authenticated functions, since I didn't need them. Adding functions
should be relatively easy, authentication could probably be done with
clojure.http.resourcefully. The clojure.http.client is what I'm using
for all the requests and I've included it in the src (yes, I know,
slightly uncool, but clojure.http doesn't appear to build to a
distributable jar and I didn't feel like fixing other people's build
scripts last night).
Some examples:
user> (require 'twitter)
nil
user> (twitter/id "technomancy")
6264792
user> (twitter/name 6264792)
"technomancy"
user> (twitter/friends 6264792)
[5674672 796136 637533 627213 10718 5444392 780561 5502392 3468841
1438261 1140261 6826152 38353 12661 790205 713263 717233 22 616673
6128392 13607 7018192 2563881 7826762 7696262 9070452 3573501 1879351
670283 654653 18713 819302 1315011 309073 12290982 6087892 3560241
13856062 753783 7643652 9462972 11340982 752673 10453902 14106454
2049071 12973272 784519 14761655 14902503 14337307 3496901 9922972
14760739 4206131 13334762 8294212 14047163 15436765 15486900 937561
16160124 9267272 16474468 16380561 14740219 14466926 11182552 14860626
764124 127583 823615 14425248 2064111 18198861 9579412 18894748 643223
18956647 14071188 14184390 14640766 14676602 21439272 14766418 5156041
6149572 11999872 21373047 6108572 29779797 14162415 5378402 16142649
9891642 23094348]
user> (map twitter/name *1)
("indirect" "eventualbuddha" "coda" "amyhoy" "topfunky" "evanphx"
"technoweenie" "mojombo" "hasmanyjosh" "atmos" "court3nay"
"kevinclark" "wbruce" "therealadam" "chadfowler" "defunkt" "pjhyett"
"rabble" "takeo" "aniero" "hober" "dougalcorn" "malabooboo" "dgoodlad"
"watsonian" "jimweirich" "_why" "chneukirchen" "drbrain" "ntalbott"
"al3x" "rubyist" "objo" "bs" "jdhuntington" "kEND" "ezmobius"
"alexvollmer" "jicksta" "sfalcon" "bitsweat" "zefrank" "jeresig"
"jbarnette" "srbaker" "brynary" "nex3" "KirinDave" "tenderlove"
"travishume" "korbodo" "jackdanger" "vinbarnes" "evri" "peepcode"
"github" "diveintomark" "giessen" "gmoothart" "augiomentus" "jm"
"cohitre" "jmhodges" "technomommy" "JMNR" "amazonmp3" "mandanjim"
"abscondment" "Jeff_Overstreet" "rschroed" "chacon" "bleything"
"rickbradley" "20seven" "ShorelineBlog" "bil_kleb" "hudsonitetech"
"cooldude127" "jwhays" "ehanchrow" "stuarthalloway" "shoover"
"danlarkin" "chrishouser" "malki" "cgrand" "dysinger" "pauldwatson"
"jeskybera" "amitrathore" "raftas" "ryanqnorth" "mattrepl" "ctennis"
"mmcgrana" "clojurebot")
Note that calling twitter/name for each of those 96 user IDs takes
awhile and Twitter does have rate limits.
Example source:
(defn name
"Name of a user given user id."
[id]
(-> (twitter-request (str "/users/show.json?user_id=" id))
(get "screen_name")))
(defn friends
"IDs of a user's friends."
[id]
(twitter-request (str "/friends/ids.json?user_id=" id)))
-Matt