Allo je voudrais que quand je tape !google blabla.. je voudrais qu'il me dise aumoin 5 lien a place de juste 1.
alors toute marche bien mes bon..
alors toute marche bien mes bon..
TCL
#######Google######
package require http
bind pub - !google pub:google
bind pub - !g pub:google
#bind pub m !debug pub:debug
set agent "Mozilla"
# Tryb Debug. "1", Domyslnie: "0".
# !debug on/off
set debug "0"
proc pub:debug { nick uhost handle channel arg } {
global debug
if {[llength $arg]==0} {
if { $debug == "0" } {
putserv "PRIVMSG $channel :\002\[NOTICE\]\002 debug\002"
} else {
putserv "PRIVMSG $channel :\002\[NOTICE\]\002 debug\002"
}
} else {
if { $arg == "on" } {
set debug "0"
putserv "PRIVMSG $channel :\002\[NOTICE\]\002 debug\002"
} elseif { $arg == "off" } {
set debug "0"
putserv "PRIVMSG $channel :\002\[NOTICE\]\002 debug\002"
}
}
}
proc pub:google { nick uhost handle channel arg } {
global agent
global debug
if {[llength $arg]==0} {
putserv "PRIVMSG $channel :La syntaxe: !Google <recherche> Ou !G ..."
} else {
set query "http://www.google.ca/custom?hl=pl&q=$arg&ie=ISO-8859-2"
set query [string map {" " "+"} $query]
putserv "PRIVMSG $channel :\002\[GOOGLE\]\002 Recherche -> $arg"
set token [http::config -useragent $agent]
set token [http::geturl $query]
set token [http::geturl $query]; regexp -nocase {(.*)} [http::data $token] -> title; http::cleanup $token;
set token [http::geturl $query]; regexp -nocase {<a href="([^"]+)" class=l[^>]*>} [http::data $token] -> newurl; http::cleanup $token;
set title [string map {"<em>" "\002*"} $title]
set title [string map {"</em>" "*\002"} $title]
set title [string map {"–" "-"} $title]
set title [string map {"—" "--"} $title]
set title [string map {"•" "-"} $title]
#### ZAKOME, W UTF-8!
set title [encoding convertfrom utf-8 $title]
#####
regexp {class=l[^>]*>([^>]*)</a>} $title -> title2
if {$debug==1} {
putserv "PRIVMSG $channel :\002\[DEBUG\]\002 \$query = $query"
if { [info exists title2] } {
putserv "PRIVMSG $channel :\002\[DEBUG\]\002 \$title2 = $title2"
} else {
putserv "PRIVMSG $channel :\002\[DEBUG\]\002 \$title2 = \002debug!\002"
}
if { [info exists newurl] } {
putserv "PRIVMSG $channel :\002\[DEBUG\]\002 \$newurl = $newurl"
} else {
putserv "PRIVMSG $channel :\002\[DEBUG\]\002 \$newurl = \002debug!\002"
}
} else {
if { [info exists title2] && [info exists newurl] } {
putserv "PRIVMSG $channel :\002\[GOOGLE\]\002 $title2 -> $newurl"
} else {
putserv "PRIVMSG $channel :\002\[GOOGLE\]\002 Next ;<"
}
}
}
}
putlog "Google 1.0 by Erreur loaded"