This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

[SOLVED] horoscop tcl

Support & discussion of released scripts, and announcements of new releases.
Post Reply
w
while
Voice
Posts: 34
Joined: Sat Jul 11, 2009 9:05 am
Location: beat mort

[SOLVED] horoscop tcl

Post by while »

hello. i have this tcl but it seems that it stopped working.. i think the site from which it grabbed the data change.
here it is:

Code: Select all

package require http
bind pub -|- !horoscop check:zodie

proc check:zodie {nick host hand chan arg} {
global check:zodie

if {![channel get $chan horoscop]} {puthelp "NOTICE $nick :FAILED: Horoscop isn`t set. Try !chanset +horoscop"; return}

set arg [lindex $arg 0]
if {$arg == "" || ![regexp {^(berbec|taur|gemeni|rac|leu|fecioara|balanta|scorpion|sagetator|capricorn|varsator|pesti)$} $arg]} {
putserv "NOTICE $nick :Foloseste: !horoscop <semn zodiacal>"
return 0
}
set pagina "http://www.zodii.ro/zodiac/$arg*zodie_$arg-horoscop_zilnic.html"
set http [http::config -useragent mozilla]
set http [http::geturl $pagina -timeout [expr 1000 * 10]]
set html [http::data $http]
http::cleanup $http ;
regexp {<div class="textArticol">(.*)} $html horoscopo
regsub -all "<div class=\"textArticol\">" $horoscopo "" horoscopo
regsub -all "</div>" $horoscopo "" horoscopo
putserv "PRIVMSG $nick :[string toupper $arg]: $horoscopo"
}
putlog "Horoscop loaded sucessfully. Created by Costin"
when i do !horoscop berbec for example all i get is BERBEC:
and nothing more. thanks
Last edited by while on Sun May 18, 2014 10:45 am, edited 1 time in total.
:)
User avatar
heartbroken
Op
Posts: 110
Joined: Thu Jun 23, 2011 11:15 pm
Location: somewhere out there

Post by heartbroken »

Code: Select all

package require http

setudef flag horoscop

 bind pub -|- !horoscop check_zodie 

 proc check_zodie {nick uhost hand chan arg} { 
    if {![channel get $chan horoscop]} { return 0 } 

        set target [lindex [split [string tolower $arg]] 0]
    if {$target eq "" || ![regexp {^(berbec|taur|gemeni|rac|leu|fecioara|balanta|scorpion|sagetator|capricorn|varsator|pesti)$} $target]} { 
        putserv "NOTICE $nick :Foloseste: !horoscop <semn zodiacal>" 
        return 0 
        } 
		
        set pagina "http://www.zodii.ro/zodiac/$target*zodie_$target-horoscop_zilnic.html" 
        set http [http::config -useragent "Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; PPC; 240x320)"]
        set http [http::geturl $pagina -timeout [expr {1000*5}]] 
        set html [http::data $http] 
        http::cleanup $http
		
		  regsub -all -- "\n" $html "" html
        regexp {</iframe><br />(.*?)</div>} $html a horoscopo
        putserv "NOTICE $nick :[string toupper $target]: $horoscopo"
		return 0
 } 
 
 putlog "Horoscop loaded sucessfully. Created by Costin" 
!horoscop balanta
bot- BALANTA: Doresti sa faci cat mai multe dar exista riscul sa gresesti. Oboseala acumulata in ultimul timp te-ar putea face sa fii mai putin eficient. O persoana mai putin cunoscuta incearca sa traga niste sfori pentru a-ti face rau, dar se va gasi cineva care sa te protejeze. Orienteaza-te spre activitati de rutina mai ales in prima parte a zilei.
> !horoscop scorpion
bot- SCORPION: Cineva din anturajul de la serviciu ti-ar putea face unele reprosuri, dar nu este cazul sa te enervezi. Traversezi o perioada in care daca doresti sa ai succes trebuie sa fii atent la toate detaliile. Colegii te vor sprijini, dar va trebui sa faci destul de multe de unul singur.Din punct de vedere financiar nu se poate spune ca nu sunt sanse de succes, dar ceva mai multa prudenta nu are ce sa-ti strice.
> !horoscop leu
bot- LEU: Nu vei fi intr-o forma prea buna si ar fi de dorit sa nu te implici in activitati care sa te suprasolicite. Obosesti mai repede decat in mod obisnuit, asa ca excesul de activitati te va face mai putin eficient. Consumul excesiv de cafea si tutun nu va face decat sa-ti accentueze sarea oboseala. Vei avea ocazia sa petreci o dupa-amiaza placuta in compania prietenilor.
Life iS Just a dReaM oN tHE wAy to DeaTh
w
while
Voice
Posts: 34
Joined: Sat Jul 11, 2009 9:05 am
Location: beat mort

Post by while »

thank you very much.
:)
User avatar
abah
Halfop
Posts: 86
Joined: Sun Dec 01, 2013 3:04 am
Location: Indonesia

Re:

Post by abah »

while wrote: Sun May 18, 2014 10:44 am thank you very much.
error from side me

Code: Select all

Tcl error [check_zodie]: can't read "horoscopo": no such variable
abah - Kota Makassar - Indonesia
User avatar
CrazyCat
Revered One
Posts: 1318
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Re: Re:

Post by CrazyCat »

abah wrote: Thu Dec 12, 2024 4:59 am
while wrote: Sun May 18, 2014 10:44 am thank you very much.
error from side me

Code: Select all

Tcl error [check_zodie]: can't read "horoscopo": no such variable
You're trying to use a script which is older than 10 years, I think the site has changed its template so the regexp used don't work anymore.
User avatar
abah
Halfop
Posts: 86
Joined: Sun Dec 01, 2013 3:04 am
Location: Indonesia

Re: Re:

Post by abah »

CrazyCat wrote: Thu Dec 12, 2024 5:15 am You're trying to use a script which is older than 10 years, I think the site has changed its template so the regexp used don't work anymore.
can i change website to indinesian website ?

Code: Select all

Tcl error [check_zodie]: Unsupported URL type "https"
abah - Kota Makassar - Indonesia
User avatar
CrazyCat
Revered One
Posts: 1318
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Re: Re:

Post by CrazyCat »

abah wrote: Thu Dec 12, 2024 5:26 am can i change website to indinesian website ?
Probably but the script won't work just with an url modification, the regexp and other datas' parsing system must be corrected.
abah wrote: Thu Dec 12, 2024 5:26 am

Code: Select all

Tcl error [check_zodie]: Unsupported URL type "https"
package require tls
::http::register https 443 [list ::tls::socket -autoservername true]
User avatar
abah
Halfop
Posts: 86
Joined: Sun Dec 01, 2013 3:04 am
Location: Indonesia

Re: Re:

Post by abah »

CrazyCat wrote: Thu Dec 12, 2024 10:45 am
package require tls
::http::register https 443 [list ::tls::socket -autoservername true]
thanks crazy but the error is back
Tcl error [check_zodie]: can't read "horoscopo": no such variable
abah - Kota Makassar - Indonesia
User avatar
CrazyCat
Revered One
Posts: 1318
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Re: [SOLVED] horoscop tcl

Post by CrazyCat »

That's what I said previously.
If the site template has changed (and I'm sure it does) or if you try with another site, the html parsing system in the script must be redone.
User avatar
BLaCkShaDoW
Op
Posts: 121
Joined: Sun Jan 11, 2009 4:50 am
Location: Romania
Contact:

Re: [SOLVED] horoscop tcl

Post by BLaCkShaDoW »

BLaCkShaDoW Production @ WwW.TclScripts.Net
Post Reply