GaucheでTwitterのtimelineを取得する
Gaucheを使ってTwitterのpublic timelineを取得し、名前と発言を順番に表示。
(use rfc.http) (use sxml.ssax) (use sxml.sxpath) (use srfi-1) (define-syntax tweet-item (syntax-rules() ((_ x) (print (second (first x)))))) (define (main args) (receive (code headers body) (http-get "twitter.com" "/statuses/public_timeline.xml") (let ((x (ssax:xml->sxml (open-input-string body) '()))) (dolist (status ((sxpath "/statuses/status") x)) (tweet-item ((sxpath '(user screen_name)) status)) (tweet-item ((sxpath '(text)) status)) (tweet-item ((sxpath '(user profile_image_url)) status)) (newline)) )))