Looks up the definition of a word
#Looks up definition of word and posts it on channel
bind pub - !def def
proc def {nick host hand chan arg} {
package require http
set url "http://lookwayup.com/lwu.exe/lwu/d?s=f&w=$arg"
set page [http::data [http::geturl $url]]
regexp {(not found\.|Spelling corrected)} $page a c
if {[info exists a]} { puts "No Results found for: $arg" }
if {[regexp {[<b>]} $page a]} {
set b 0
putserv "PRIVMSG $chan :Definition of: $arg"
while {[regexp {<b>(.*?)<\/b>} $page a c]} {
incr b
regexp {<b>(.*?)<\/b>} $page a def
regsub {<b>(.*?)<\/b>} $page "" page
putserv "PRIVMSG $chan :$b. $def"
}
}
}
putlog "Definition v1.0"