I guess this is the right place to post it since there's no way to contact author...
Updating http.tcl from v2.5.001 to 2.7.1, horoscope.tcl I'm using stopped working
How could it be fixed? (if I go back to older http.tcl, the script works again).Tcl error [pub:horoscopo]: Unsupported URL: www.terra.cl/astrologia/include/pop_h_d ... m?signo=19
This is the short script
Code: Select all
# Reportar Errores a mi
# Aportes y actualizaciones seran bienvenidas =)
# Aguante las Tcls
bind pub - !horoscopo pub:horoscopo
proc pub:horoscopo {nick host hand chan arg} {
set arg [lindex $arg 0]
if {$arg==""} {
putserv "NOTICE $nick :4Usa: 14!horoscopo <signo>, 4Ej: 14!horoscopo aries"
return 0
}
switch [string tolower $arg] {
"aries" {
set pagina "www.terra.cl/astrologia/include/pop_h_diario.cfm?signo=2"
} "tauro" {
set pagina "www.terra.cl/astrologia/include/pop_h_diario.cfm?signo=19"
} "geminis" {
set pagina "www.terra.cl/astrologia/include/pop_h_diario.cfm?signo=7"
} "cancer" {
set pagina "www.terra.cl/astrologia/include/pop_h_diario.cfm?signo=3"
} "leo" {
set pagina "www.terra.cl/astrologia/include/pop_h_diario.cfm?signo=10"
} "virgo" {
set pagina "www.terra.cl/astrologia/include/pop_h_diario.cfm?signo=22"
} "libra" {
set pagina "www.terra.cl/astrologia/include/pop_h_diario.cfm?signo=11"
} "escorpion" {
set pagina "www.terra.cl/astrologia/include/pop_h_diario.cfm?signo=6"
} "sagitario" {
set pagina "www.terra.cl/astrologia/include/pop_h_diario.cfm?signo=16"
} "capricornio" {
set pagina "www.terra.cl/astrologia/include/pop_h_diario.cfm?signo=4"
} "acuario" {
set pagina "www.terra.cl/astrologia/include/pop_h_diario.cfm?signo=1"
} "piscis" {
set pagina "www.terra.cl/astrologia/include/pop_h_diario.cfm?signo=14"
} default {
putserv "PRIVMSG $chan :4Signos validos: 14aries, tauro, geminis, cancer, leo, virgo,\
libra, escorpion, sagitario, capricornio, acuario y piscis."
}
}
set http [http::config -useragent mozilla]
set http [http::geturl $pagina -timeout [expr 1000 * 10]]
set html [http::data $http]
regexp {<span class="txt_2_10"><b></b><br>(.*)} $html horoscopo
regsub -all "<span class=\"txt_2_10\"><b></b><br>" $horoscopo "" horoscopo
regsub -all "<br></span>" $horoscopo "" horoscopo
putserv "PRIVMSG $chan :4[string toupper $arg]:14 $horoscopo"
}