egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

livescore tcl

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
heroes
Voice


Joined: 01 Dec 2007
Posts: 17

PostPosted: Sun Aug 10, 2008 3:40 am    Post subject: livescore tcl Reply with quote

any idea about soccer score tcl??
ehmm...
can auto post to channel the update score.
take the score from livescore.com
or other web.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
eXtremer
Op


Joined: 07 May 2008
Posts: 138

PostPosted: Mon Aug 11, 2008 2:40 am    Post subject: Re: livescore tcl Reply with quote

heroes wrote:
any idea about soccer score tcl??
ehmm...
can auto post to channel the update score.
take the score from livescore.com
or other web.


hmmm interesting...
Back to top
View user's profile Send private message
moff
Voice


Joined: 24 Jul 2008
Posts: 27

PostPosted: Wed Nov 26, 2008 3:44 pm    Post subject: Reply with quote

Code:
################################################################################
#                                                                              #
#      :::[  T h e   R u s s i a n   E g g d r o p  R e s o u r c e  ]:::      #
#    ____                __                                                    #
#   / __/___ _ ___ _ ___/ /____ ___   ___      ___   ____ ___ _     ____ __ __ #
#  / _/ / _ `// _ `// _  // __// _ \ / _ \    / _ \ / __// _ `/    / __// // / #
# /___/ \_, / \_, / \_,_//_/   \___// .__/ __ \___//_/   \_, / __ /_/   \___/  #
#      /___/ /___/                 /_/    /_/           /___/ /_/              #
#                                                                              #
################################################################################
#                                                                              #
# livescore.tcl 2.0                                                            #
#                                                                              #
# Author: Stream@Rusnet <stream@eggdrop.org.ru>                                #
#                                                                              #
# Official support: irc.eggdrop.org.ru @ #eggdrop                              #
#                                                                              #
################################################################################

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 - !score   ::ls::pub_ls
bind pub - !livescore   ::ls::pub_ls
bind msg - !ls      ::ls::msg_ls
bind msg - !score   ::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 "Use !livescore \[-country\] <search_mask>. Mask can contain '*' and '?', search will be performed in command names and scores."; 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 "Use !livescore \[-country\] <search_mask>. Mask can contain '*' and '?', search will be performed in command names and scores."; 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 "Please wait till last query will be finished..."; 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 "cant connect to 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 "cant connect to 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 "Available values: $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 score team2]} {
         if {![regexp -nocase -- {<tr.*><td.*>\ \;(.*?)</td><td.*>(.*?)</td><td.*>(.*?)</td><td.*>(.*?)</td>} $line garb state team1 score team2]} {continue}
      }
      regsub -nocase {^(.*?)\-(.*?)$} $score {\1-\2} score
      set res "($state) $team1 $score $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 "Showed $resshown from $restotal (full list will be available by command to PM)."}
}

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 "cant connect to livescore.com..."
}

putlog "livescore.tcl v$ls(ver) by $ls(authors) loaded"


found this one, but i dont get output
Back to top
View user's profile Send private message
guest
Halfop


Joined: 19 Jan 2004
Posts: 52

PostPosted: Thu Nov 27, 2008 2:54 pm    Post subject: Reply with quote

any chance of getting a script that does other sports like nba mlb nfl
Back to top
View user's profile Send private message
Nor7on
Op


Joined: 03 Mar 2007
Posts: 185
Location: Spain - Barcelona

PostPosted: Sat Oct 24, 2009 3:16 pm    Post subject: Reply with quote

some update for this script? actually no found.

thanks.
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
Behemoth
Voice


Joined: 19 May 2008
Posts: 20
Location: Mauritius

PostPosted: Mon Oct 26, 2009 12:49 pm    Post subject: livescore.tcl Reply with quote

hello..
can the above posted script ( livescore.tcl ) be translated in English plz ?


thnkx
_________________
Http://optix-pro.labrute.fr/
Http://ircaz.fr/

Losers Always Whine About Their Best, But Winners Go Home And F*** The Prom Queen!
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address MSN Messenger
DaRkOoO
Halfop


Joined: 27 Sep 2008
Posts: 67

PostPosted: Mon Oct 26, 2009 6:24 pm    Post subject: Reply with quote

It doesn't work..
Back to top
View user's profile Send private message
Tumpero
Voice


Joined: 04 Jul 2008
Posts: 2

PostPosted: Sun Dec 20, 2009 7:29 am    Post subject: Reply with quote

Any luck for this?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber