Created
December 7, 2010 02:06
-
-
Save fons/731357 to your computer and use it in GitHub Desktop.
example of the search api in cl-twitter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define-element search-ref ( (metadata search-ref-metadata)) | |
"An individual search reference" | |
(id "Integer ID of message" nil) | |
(text "The text of the tweet" nil) | |
(to-user "Screen name" nil) | |
(to-user-id "ID of receiver" nil) | |
(from-user "Screen name" nil) | |
(from-user-id "ID of sender" nil) | |
(iso-language-code "Two character language code for content" nil) | |
(source "Source of the result" nil) | |
(profile-image-url "The profile image of the sender") | |
(created-at "The date of message creation" nil) | |
(metadata nil "") | |
(geo "FIXME unparsed")) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun do-search (query &key (max-pages 15) ) | |
(let ((ht (make-hash-table :test 'equal :size 1500))) | |
(labels ((collect-it (slst) | |
(dolist (item slst) | |
(setf (gethash (search-ref-id item) ht) item)))) | |
(with-paging (:collector #'collect-it :max-pages max-pages :test #'rate-limit-exceeded ) (search-twitter query)) | |
ht))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun search-twitter (query &rest args &key (callback nil) (lang nil) (locale nil) (rpp nil) (page nil) | |
(since-id nil) (until nil) (geocode nil) (show-user nil) (result-type nil) ) | |
(declare (ignore callback lang locale rpp page since-id until geocode show-user result-type )) | |
(apply 'twitter-op :search :q query (rem-nil-keywords args '(:callback :geocode :lang :until)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TWIT> (setf *R* (do-search "Ponies")) | |
; Evaluation aborted. | |
TWIT> (setf *R* (do-search "Ponies")) | |
#<HASH-TABLE :TEST EQUAL :COUNT 1499 {100413AF21}> | |
TWIT> (maphash (lambda (k v) (print-search-ref v)) *R*) | |
[...] | |
[Mon, 06 Dec 2010 07:54:53 +0000] TheMightyAlexx_: I love ponies and sunshine and *falls* privates! | |
[Mon, 06 Dec 2010 07:52:51 +0000] HabboGuy: @Dq231 I LIKE PONIES AND SUNINE AND DOOSH SNOOKIE | |
[Mon, 06 Dec 2010 07:51:41 +0000] stationbred: That fancy Spanish horse and his grassyarse. Why can't he just say "thanks" like the rest of us common or garden ponies... | |
[Mon, 06 Dec 2010 07:37:24 +0000] DSchiller: Off to see the ponies..in the rain! Looove | |
[Mon, 06 Dec 2010 07:29:21 +0000] BarackOBoogie: "@Meezy_TaughtYou: @snazmindanielle Did you just call us ponies?? YOU WERE A DOLPHIN!" (Remember That Noise!) | |
[Mon, 06 Dec 2010 07:28:44 +0000] Meezy_TaughtYou: @snazmindanielle Did you just call us ponies?? YOU WERE A DOLPHIN! | |
[Mon, 06 Dec 2010 07:28:11 +0000] HoneeBeeBesos: RT @snazmindanielle: "@FashionGenius90: #NoOneLikesYouBecause you went to WY *shots fired* haha (jadakiss voice)"<<this is #dumb. Damned ponies | |
[Mon, 06 Dec 2010 07:27:40 +0000] snazmindanielle: "@FashionGenius90: #NoOneLikesYouBecause you went to WY *shots fired* haha (jadakiss voice)"<<this is #dumb. Damned ponies | |
[Mon, 06 Dec 2010 07:26:45 +0000] CrayonChewer: @kuiperfrog WATCHING PONIES WITHOUT ME?!? | |
[Mon, 06 Dec 2010 07:22:21 +0000] TheMightyAlexx_: @DopeDoofs Suck a ponies balls bitch >:D | |
I don't do 1v1 in skate, I do 2v1(; me against you and someone else! | |
[Mon, 06 Dec 2010 07:22:17 +0000] kuiperfrog: @CrayonChewer Come watch things with me & momo we are... watching more ponies orz | |
[Mon, 06 Dec 2010 07:22:13 +0000] bookmooch: Miss Parker's Ponies (Zebra Regency Romance) http://bookmooch.com/0821775383 #bricked #US #rom | |
[Mon, 06 Dec 2010 07:04:54 +0000] alexdickson: RT @zerkms: @alexdickson you can do the same with "sql" tag and OMG Ponies :-) | |
[Mon, 06 Dec 2010 06:59:44 +0000] Symmetricalmoon: @discardoursouls musexualslaves, the ponies are back, and the colourful waters, the cocks and the flowersZZ #gay #yupi | |
[Mon, 06 Dec 2010 06:56:26 +0000] nurelanwar: DUDE. I AM COMING OVER. WE NEED TO HANG. I'll help you clean :) RT @kamiliatahani: Throwing out my 'my little ponies' :( | |
[Mon, 06 Dec 2010 06:40:01 +0000] LizziMallory: Holiday TV: Dec. 3: Temecula’s Priceless Ponies invites area children to holiday camp Children will enjoy not ju... http://bit.ly/ecaRMv | |
[...] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment