#!/usr/bin/gosh
;A scheme program to parse LeFigaro headlines and generate RSS 0.91 output.
;Copyright (c) 2004 Junichi Uekawa
;Distributed under GPL version 2 or later.
(use rfc.http)
(use gauche.charconv)
(use srfi-11)
(use srfi-13)
(let*
(
(html
(ces-convert
(let-values (((code head body) (http-get "www.lefigaro.fr" "/index.html"))) body)
"iso-8859-1" "utf-8"))
(my-regexp (string->regexp "([^<]*)
.*?.*?([^<]*)"))
(match #f)
)
(print "
Le Figaro
http://www.lefigaro.fr/
RSS feed for Le Figaro
fr
")
(do ()
((eqv? (eqv? html #f) #t)) ;; if false, execute commands.
(set! match (rxmatch my-regexp html))
(if match
(rxmatch-let
match
(#f aref headline text)
(print
(format "
-
~s
http://www.lefigaro.fr~s
~s
"
headline aref text))
(set! html (match 'after)))
(set! html #f)))
(print "
"))