Page 1 of 1

5 Cent tip for today [ RSS Title Slurper ]

Posted: Fri Jul 16, 2004 5:28 pm
by newdep
;;
;; RSS Title Slurp - (c) Norman 2004
;; version 1.1 stripped version
;; fixed for "!--"
;;

; http://rss.news.yahoo.com/rss/linux
; http://rss.news.yahoo.com/rss/cellphones
; http://newlisp.org/rss.cgi?News

(set 'url "http://rss.news.yahoo.com/rss/science" )

(println "** RSS Feed -> " url )

;;
;; DE-XML
;;
(xml-type-tags nil 'cdata '!-- nil)
(set 'url (xml-parse (get-url url) (+ 1 2 8 16) ))

;; pop until rss
(until (= (first (nth 0 url)) 'rss ) (pop url))

(set 'rsschannel (nth 2 (nth 0 url)))
(set 'rsschannellen (length rsschannel))

;;
;; Seeking for ITEMS in CHANNEL
;;
(dotimes (y rsschannellen)
(if (list? (nth y rsschannel))
(if (= (nth 0 (nth y rsschannel)) 'item )
(println "** RSS Item -> " (lookup 'title (nth y rsschannel))))))

(exit)

;; enjoy...