bind pub -|- !yt yt_search
###
### youtube getlink v 0.1
###
### just a simple script that fetches the first
### result from a youtube search, giving you
### the link, title and description for the primary
### result
###
### nothing can be set here
### if you know tcl please edit to fit your need
### grtz hwk
### contact me at: lowraider1@gmail.com
package require http
proc yt_search {nick uhost hand chan args} {
regsub -nocase -all " " $args "+" yt(squery)
set yt(surl) "http://youtube.com/results?search_query=$yt(squery)&search_type="
http::config -useragent mozilla
set urltok [http::geturl $yt(surl) -timeout 20000]
set yt(rpage) [http::data $urltok]
http::cleanup $urltok
regsub -nocase -all (<b>|</b>|\t|<i>|</i>) $yt(rpage) "" rpage
regexp -line -- {<div class="vlshortTitle">\n(.*)\n</div>} $rpage -> yt(infos)
regexp {<a href="(.*)" title} $yt(infos) -> yt(link)
regexp {>(.*)</a>} $yt(infos) -> yt(title)
regexp -line -- {<div class="vldesc">\n(.*)\n</div>\n</div>} $rpage -> yt(desc)
if {[string match -nocase "*No Videos found*" $rpage] || ![info exists yt(title)]} {puthelp "privmsg $chan :Nothing found"} else {
puthelp "privmsg $chan :LINK: http://youtube.com$yt(link) | Title: $yt(title) | Description: $yt(desc)"}
}
putlog "youtube getlink v 0.1 by hwk loaded"
Use this page http://forum.egghelp.org/viewtopic.php?t=10215 to get all the informations on hw to enable .tcl command and see if the script is giving any error when you trigger the main command.
So what you need to do is:
1. Activate .tcl command from eggdrop.conf
2. Use /ctcp botnick chat
3. Use .tcl $errorInfo (copy paste here the output here)