cl-rw

Layered streams for Common Lisp
git clone https://logand.com/git/cl-rw.git/
Log | Files | Refs

commit 7a24111228b17532667522f2f3b3aefc9c2c02aa
parent c91a5ca6a5c8c0a3ed2d2746017af29707e29397
Author: Tomas Hlavaty <tom@logand.com>
Date:   Thu, 24 Oct 2013 01:08:57 +0200

download-rss added

Diffstat:
Mcl-rw.asd | 2+-
Mnet.lisp | 13++++++++++++-
2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/cl-rw.asd b/cl-rw.asd @@ -41,12 +41,12 @@ (:file "xml") (:file "email") (:file "os") - (:file "net") (:file "concurrency") (:file "css") (:file "html") (:file "socket") (:file "uri") (:file "http") + (:file "net") (:file "calendar") (:file "ui"))) diff --git a/net.lisp b/net.lisp @@ -23,7 +23,8 @@ (defpackage :rw.net (:use :cl) (:export :curl - :wget)) + :wget + :download-rss)) (in-package :rw.net) @@ -64,3 +65,13 @@ ;;(curl "http://localhost:631/printers/" :response-file "printers.html") ;;(curl "http://localhost:631/jobs/82" :response-file "job-status.html") + +(defun download-rss (url) + (let ((body (nth-value 4 (rw.http:client url)))) + (when body + (let ((rss (rw.xml:parse-xml body))) ;; TODO parse directly from socket/stream? + (when rss + (assert (eq :rss (if (atom rss) (car rss) (caar rss)))) + rss))))) + +;;(download-rss "http://www.spiegel.de/international/index.rss")