Code :
proc youtube {nick uhost hand chan arg} {
if {[info exists ::checks($nick)] && ([clock seconds] - $::checks($nick)) < $::youtube(spam)} { sendmsg $chan "Fk off spammer.."; return }
set ::checks($nick) [clock seconds]
if {$arg == ""} { putmsg $nick "Please use: $::youtube(trigger) KEYWORD"; return }
set form [http::formatQuery search_query $arg search search]
set tok [http::geturl http://www.youtube.com/results?search_type=&$form -timeout $::youtube(timeout)]
set data [http::data $tok]
http::cleanup $tok
set a "0"
while {[regexp -- {<h3><a href="(.*?)" dir="ltr" title="(.*?)" >(.*)$} $data -> number title]} {
if {$a == $::youtube(results)} { break }
sendmsg $chan "\[Title: $title Link:http://youtube.com$number\]"
incr a
}
if {![info exists title]} { sendmsg $chan "\002Error:\002 Nothing found for '$arg'" }
}