Anyone know of a simple script that will just publicly message the titles of urls pasted in a channel?
Thanks! :oops:
Code: Select all
{<title>(.*?)</title>}
Code: Select all
putlog "loaded: url.tcl (lists url titles from channel - thanks to rosc2112)"
package require http 2.3
bind pubm - * webcheck
proc webcheck {nick uhost hand chan text} {
foreach i $text {
if {([string match "*http://*" $i]) || ([string match "*www.*" $i])} {
set url [string trim $i]
set url [split $url]
regsub -all {http://+} $url "" url
catch {set page [::http::geturl $url -timeout 90000]} error
set html [::http::data $page]
::http::cleanup $page
foreach line {[split $html \n]} {
if {[regexp -nocase {<title>(.*?)</title>} $html match titlematch]} {
regsub -all {&+} $titlematch "&" titlematch
if { ([string match "*302*" $titlematch])} {
} else {putserv "PRIVMSG $chan :^BURL title:^B [join $titlematch]" }
}}
}
}
}