- Код: Выделить всё
- if {![info exists egglib(ver)]} {
 putlog "************************************************"
 putlog " egglib_pub NOT FOUND !"
 putlog " Download last version of egglib_pub here:"
 putlog " http://eggdrop.org.ru/scripts/egglib_pub.zip"
 putlog "************************************************"
 die
 }
 if {[expr {$egglib(ver) < 1.4}]} {
 putlog "************************************************"
 putlog " YOUR VERSION OF egglib_pub IS TOO OLD !"
 putlog " Download last version of egglib_pub here:"
 putlog " http://eggdrop.org.ru/scripts/egglib_pub.zip"
 putlog "************************************************"
 putlog " version installed : $egglib(ver)"
 putlog " version required: 1.4"
 die
 }
 #################################################
 namespace eval ls {}
 setudef flag nopubls
 #################################################
 bind pub - !ls ::ls::pub_ls
 bind pub - !<span class="posthilit">score</span> ::ls::pub_ls
 bind pub - !livescore ::ls::pub_ls
 bind msg - !ls ::ls::msg_ls
 bind msg - !<span class="posthilit">score</span> ::ls::msg_ls
 bind msg - !livescore ::ls::msg_ls
 #################################################
 foreach p [array names ls *] { catch {unset ls($p)} }
 #max results per public query
 set ls(maxres) 10
 set ls(timeout) 20
 set ls(debug) 1
 set ls(use_proxy) 0
 set ls(proxy_host) "proxy1.bezeqint.net"
 set ls(proxy_port) 3128
 #################################################
 ##### DON'T CHANGE ANYTHING BELOW THIS LINE #####
 #################################################
 set ls(ver) "2.0"
 set ls(authors) "Stream@RusNet <stream@eggdrop.org.ru>"
 set ls(agent) "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 1.0.3705)"
 #################################################
 proc ::ls::pub_ls { nick uhost hand chan args } {
 if {[channel get $chan nopubls]} return
 set args [string tolower [string trim $args]]
 if {[llength [split [lindex $args 0]]] > 1 || [llength [split [lindex $args 0]]] == 0} {set args [split [lindex $args 0]]}
 if {[llength $args] < 1} {::egglib::outn $nick "Izpolzvai !livescore \[-strana\] <maska>. maskata moge da sydyrga '*' i '?' ."; return}
 ::ls::ls $nick $uhost $hand $chan $args
 }
 proc ::ls::msg_ls { nick uhost hand args } {
 set args [string tolower [string trim $args]]
 if {[llength [split [lindex $args 0]]] > 1 || [llength [split [lindex $args 0]]] == 0} {set args [split [lindex $args 0]]}
 if {[llength $args] < 1} {::egglib::outn $nick "Izpolzvai !livescore \[-strana\] <maska>. maskata moge da sydyrga '*' i '?' ."; return}
 ::ls::ls $nick $uhost $hand $nick $args
 }
 #################################################
 proc ::ls::ls { nick uhost hand chan args } {
 global ls
 if {[info exists ls(host,$uhost)]} {::egglib::outn $nick "Predishnata zaqvka ne e izlylnena oshte..."; return}
 if {[llength [split [lindex $args 0]]] > 1 || [llength [split [lindex $args 0]]] == 0} {set args [split [lindex $args 0]]}
 
 if {[string range [lindex $args 0] 0 0] == "-"} {
 set country [string range [lindex $args 0] 1 end]
 set mask [lrange $args 1 end]
 } else {
 set country "ukraine"
 set mask $args
 }
 
 ::egglib::log $chan $nick "ls" "$country $mask"
 if {[string range $mask 0 0] != "*"} {set mask "*$mask"}
 if {[string range $mask end end] != "*"} {set mask "$mask\*"}
 set ls(host,$uhost) [list $country $mask]
 set url "http://www.livescore.com/default.dll?page=$country"
 set id [::egglib::http_init "::ls::ls_"]
 if {$ls(use_proxy)} {::egglib::http_set_proxy $id $ls(proxy_host) $ls(proxy_port)}
 ::egglib::http_set_timeout $id $ls(timeout)
 ::egglib::http_get $id $url [list $nick $chan $uhost]
 }
 proc ::ls::ls_on_data { id html nick chan uhost } {
 global ls
 if {$ls(debug)} {putlog "\[ls\] callback executed... analyzing data..."}
 
 regsub -all -nocase -- <tr $html \n<tr html
 #::egglib::writedata "debugls.htm" [list $html]
 
 foreach line [split $html \n] {
 if {[regexp -nocase -- {<html>.*robots.*refresh.*URL\=(.*?)\".*action\=\"(.*?)\".*value\=\"(.*?)\"} $line garb url posturl sid]} {
 putlog "antibot check found. redirecting to $url & POSTing to $posturl (params sid=$sid)"
 set url "http://www.livescore.com$url"
 set id [::egglib::http_init "::ls::ls1_"]
 if {$ls(use_proxy)} {::egglib::http_set_proxy $id $ls(proxy_host) $ls(proxy_port)}
 ::egglib::http_set_timeout $id 1
 ::egglib::http_get $id $url [list $nick $chan $uhost]
 set url "http://www.livescore.com$posturl"
 set param "sid=$sid"
 set id [::egglib::http_init "::ls::lspost_"]
 if {$ls(use_proxy)} {::egglib::http_set_proxy $id $ls(proxy_host) $ls(proxy_port)}
 ::egglib::http_set_timeout $id $ls(timeout)
 ::egglib::http_set_method $id "POST"
 ::egglib::http_post $id $url $param [list $nick $chan $uhost]
 break
 }
 }
 
 if {$ls(debug)} {putlog "\[ls\] html parsed"}
 }
 proc ::ls::ls_on_error { id nick chan uhost } {
 global ls
 catch {unset ls(host,$uhost)}
 if {$ls(debug)} {putlog "\[ls\] connection timed out"}
 if {$nick == " "} {return}
 ::egglib::out $nick $chan "nemoga da se svyrga s livescore.com..."
 }
 proc ::ls::ls1_on_data { id html nick chan uhost } {
 ::egglib::writedata "debugls1.htm" [list $html]
 if {$ls(debug)} {putlog "\[ls1\] callback executed! Something is wrong..."}
 }
 proc ::ls::ls1_on_error { id nick chan uhost } {
 global ls
 if {$ls(debug)} {putlog "\[ls1\] connection timed out - OK"}
 }
 proc ::ls::lspost_on_data { id html nick chan uhost } {
 global ls
 if {$ls(debug)} {putlog "\[lspost\] callback executed... analyzing data..."}
 #::egglib::writedata "debugpost.htm" [list $html]
 
 set moved 0
 foreach line [split $html \n] {
 if {[string match "HTTP* 302 Object Moved" $line]} {set moved 1
 } elseif {$moved == 1} {
 if {[regexp -nocase -- {^Location\:\ (.*?)$} $line garb url]} {
 if {$ls(debug)} {putlog "recieved HTTP 302 Object Moved, new location: $url"}
 set url "http://www.livescore.com$url"
 set id [::egglib::http_init "::ls::ls2_"]
 if {$ls(use_proxy)} {::egglib::http_set_proxy $id $ls(proxy_host) $ls(proxy_port)}
 ::egglib::http_set_timeout $id $ls(timeout)
 ::egglib::http_get $id $url [list $nick $chan $uhost]
 }
 }
 }
 if {$ls(debug)} {putlog "\[lspost]: html parsed"}
 }
 proc ::ls::lspost_on_error { id nick chan uhost } {
 global ls
 catch {unset ls(host,$uhost)}
 if {$ls(debug)} {putlog "\[lspost\] connection timed out"}
 if {$nick == " "} {return}
 ::egglib::out $nick $chan "nemoga da se svyrga s livescore.com..."
 }
 proc ::ls::ls2_on_data { id html nick chan uhost } {
 global ls
 catch {
 set country [lindex $ls(host,$uhost) 0]
 set mask [lrange $ls(host,$uhost) 1 end]
 #putlog "country = $country , mask = $mask"
 unset ls(host,$uhost)
 }
 if {$ls(debug)} {putlog "\[ls2\] callback executed... analyzing data..."}
 
 regsub -all -nocase -- <tr $html \n<tr html
 #::egglib::writedata "debugls2.htm" [list $html]
 
 if {$nick != $chan} {set nick ""}
 set cfound 0
 set cts ""
 set title ""
 set tshown 0
 set timedate ""
 set tdshown 0
 set resshown 0
 set restotal 0
 foreach line [split $html \n] {
 if {$cfound == 0} {
 if {[regexp -nocase -- {<tr><td.*><img.*name\=\"i(.*)\"\ alt.*><a\ href\=\"/default.dll\?page\=([a-z]+)\"\ on.*>(.*?)</a></td></tr>} $line garb cnum page ctr]} {
 if {$cnum > 4} {
 if {$cts == ""} {set cts $page} else {set cts "$cts\, $page"}
 if {$page == $country} {set cfound 1}
 }
 } elseif {[regexp -nocase -- {<tr><td.*><img.*name\=\"i(.*)\"\ alt.*><a\ href\=\"/default.dll\?page\=([a-z]+)\"\ class\=\"selected\">(.*?)</a></td></tr>} $line garb cnum page ctr]} {
 if {$cnum > 4} {
 if {$cts == ""} {set cts $page} else {set cts "$cts\, $page"}
 if {$page == $country} {set cfound 1}
 }
 }
 if {[string match "<tr><td colspan=\"4\" height=\"1\"></td></tr>" $line] && $cfound == 0} {
 ::egglib::out $nick $chan "Доступные значения: $cts"
 return
 }
 }
 if {[regexp -nocase -- {^<tr.*><td\ class\=\"title\".*>\ \;<b>(.*?)</b>\ \-\ (.*?)</td></tr>} $line garb country league]} {
 set title "\002$country\002 - $league"
 set tshown 0
 set tdshown 0
 set timedate ""
 #putlog "title = $title"
 continue
 } elseif {[regexp -nocase -- {^<tr.*><td.*>\ \;(.*?)</td><td.*>(.*?)\ \;</td></tr>$} $line garb tm dt]} {
 if {$tm == ""} {set timedate $dt} else {set timedate "$tm, $dt"}
 set tdshown 0
 #putlog "timedate = $timedate"
 continue
 } elseif {![regexp -nocase -- {<tr.*><td.*>\ \;(.*?)</td><td.*>(.*?)</td>.*<a.*>(.*?)</a></td><td.*>(.*?)</td>} $line garb state team1 <span class="posthilit">score</span> team2]} {
 if {![regexp -nocase -- {<tr.*><td.*>\ \;(.*?)</td><td.*>(.*?)</td><td.*>(.*?)</td><td.*>(.*?)</td>} $line garb state team1 <span class="posthilit">score</span> team2]} {continue}
 }
 regsub -nocase {^(.*?)\-(.*?)$} $<span class="posthilit">score</span> {\1-\2} <span class="posthilit">score</span>
 set res "($state) $team1 $<span class="posthilit">score</span> $team2"
 if {[string match $mask [string tolower $res]]} {
 #putlog "res = $res"
 incr restotal
 if {$restotal > $ls(maxres) && $nick != $chan} {continue}
 incr resshown
 if {$tshown == 0} {
 ::egglib::out $nick $chan $title
 set tshown 1
 }
 if {$tdshown == 0} {
 ::egglib::out $nick $chan $timedate
 set tdshown 1
 }
 ::egglib::out $nick $chan $res
 }
 }
 if {$ls(debug)} {putlog "\[ls2\] html parsed"}
 if {$resshown < $restotal} {::egglib::out $nick $chan "Pokazani $resshown ot $restotal (pylniq spisyk shte byde pokazan s komanda na private)."}
 }
 proc ::ls::ls2_on_error { id nick chan uhost } {
 global ls
 catch {unset ls(host,$uhost)}
 if {$ls(debug)} {putlog "\[ls2\] connection timed out"}
 if {$nick == " "} {return}
 ::egglib::out $nick $chan "nemoga da se svyrga s livescore.com..."
livesoccer.com script not work anyone update plss plsss
thankss




