home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2005 June
/
ccd0605.iso
/
Software
/
Shareware
/
Comunicatii
/
nat32
/
RSS.TCL
< prev
next >
Wrap
Text File
|
2004-03-15
|
981b
|
42 lines
#!tcl
#
# RSS Paser
#
set counter 0
set item 0
set tcount 0
set lcount 0
set link ""
set title ""
# Parse STDIN line by line, write HTML to STDOUT
while {[set len [gets stdin line]] >= 0} {
regsub -all "\\&" $line "\\\\&" line
if {[regexp "<item(.*)>" $line]} { set item 1 }
if {[regexp "</item>" $line]} { set item 0 }
if {$item == 1} {
if {[regexp "<title>(.*)</title>" $line title]} {
regsub "<title>" $title "" title
regsub "</title>" $title "" title
incr tcount
}
if {[regexp "<link>(.*)</link>" $line link]} {
regsub "<link>" $link "" link
regsub "</link>" $link "" link
incr lcount
}
if {$tcount && $lcount} {
puts stdout "<br><a href=\"$link\">$title</a>"
incr counter
set tcount 0
set lcount 0
}
}
}
echo "<br> $counter links converted"