What can i do to stop it from starting a
new line for every space in a line say i was pulling some info from a page and it looked like this:
<title>Mining Unstructured Data</title>
<url>http://slashdot.org/article.pl?sid=02/0 ... 19233</url>
<time>2002-03-15 23:18:33</time>
<author>michael</author>
it would return it like:
<title>Mining
(BoT) Unstructured
(BoT) Data</title>
(BoT) <url>http://slashdot.org/article.pl?sid=02/0 ... 19233</url>
(BoT) <time>2002-03-15
(BoT) 23:18:33</time>
(BoT) <author>michael</author>
which is starting the lines with spaces on a new line each time.
so with this script its not returning the title cause its split up and cant find <title> and </title> on one line for foreach...
bind pub - !slash slash
proc slash {nick host hand chan arg} {
set url "/slashdot.xml"
if {[catch {set sock [socket -async slashdot.org 80]} sockerr]} {
putserv "PRIVMSG $chan :$sockerr"
close $sock
return 0
}
puts $sock "GET $url"
flush $sock
set slash [gets $sock]
close $sock
foreach line $slash {
puts $line
set i [string first "<title>" $line]
if {$i != -1} {
set j [string last "</title>" $line]
putserv "PRIVMSG $chan :02[string range $line [expr $i + 7] [expr $j - 1]]02"
} else {
set i [string first "<url>" $line]
if {$i != -1} {
set j [string last "</url>" $line]
putserv "PRIVMSG $chan [string range $line [expr $i + 5] [expr $j - 1]])"
}
}
}
}