Версия: 1.0
Автор: tvrsh
Описание: livescore.com score search script
Поддержка Suzi: No
Пример работы:
<tvrsh> !score
<bionic> tvrsh, use !score team
<tvrsh> !score cerro
<@bionic> 90' Cerro 1 - 1 Defensor Sporting
<tvrsh> !score cerro2
<@bionic> Nothing found for team cerro2
Дополнительная информация:
Ссылка на скрипт:
package require http 2.4
bind pub - !score score
proc score {nick uhost hand chan text} {
set t [::http::geturl "http://www.livescore.com/soccer/live/" -timeout "15000"]
set data [::http::data $t]
::http::cleanup $t
if {$text == ""} {
putserv "PRIVMSG $chan :\00303$nick\00314, use \00312!score team\003"
return 0
}
regsub -all -- {\s+} $data " " data
regsub -all -- "\n|\t" $data "" data
regsub -all -- {<a .*?>} $data "" data
regsub -all -- {<td .*?>} $data "" data
regsub -all -- {<tr .*?>} $data "" data
regsub -all -nocase -- {^.*?<img src="http://cdn3.livescore.com/img/flash.gif" width="8" height="8" border="0">} $data "" livegames
regsub -all -nocase -- {<table cellspacing="0" cellpadding="0" border="0">.*?$} $livegames"" livegames
regsub -all -- {<img src="http://cdn3.livescore.com/img/flash.gif" width="8" height="8" border="0">} $livegames "|" livegames
foreach line [split $livegames "|"] {
set time ""; set team1 ""; set score ""; set team2 ""
regexp {(.*?)</td>(.*?)</td>(.*?)</a></td>(.*?)</td>} $line "" time team1 score team2
if {$time != "" && $team1 != "" && $score != "" && $team2 != "" && ([string toupper $text] == [string toupper $team1] || [string toupper $text] == [string toupper $team2])} {
putserv "PRIVMSG $chan :\00303$time \00314$team1 \00312$score \00314$team2\003"
return 0
}
}
putserv "PRIVMSG $chan :\00314Nothing found for team \00312$text\003"
return 0
}
bind pub - !score score
proc score {nick uhost hand chan text} {
set t [::http::geturl "http://www.livescore.com/soccer/live/" -timeout "15000"]
set data [::http::data $t]
::http::cleanup $t
if {$text == ""} {
putserv "PRIVMSG $chan :\00303$nick\00314, use \00312!score team\003"
return 0
}
regsub -all -- {\s+} $data " " data
regsub -all -- "\n|\t" $data "" data
regsub -all -- {<a .*?>} $data "" data
regsub -all -- {<td .*?>} $data "" data
regsub -all -- {<tr .*?>} $data "" data
regsub -all -nocase -- {^.*?<img src="http://cdn3.livescore.com/img/flash.gif" width="8" height="8" border="0">} $data "" livegames
regsub -all -nocase -- {<table cellspacing="0" cellpadding="0" border="0">.*?$} $livegames"" livegames
regsub -all -- {<img src="http://cdn3.livescore.com/img/flash.gif" width="8" height="8" border="0">} $livegames "|" livegames
foreach line [split $livegames "|"] {
set time ""; set team1 ""; set score ""; set team2 ""
regexp {(.*?)</td>(.*?)</td>(.*?)</a></td>(.*?)</td>} $line "" time team1 score team2
if {$time != "" && $team1 != "" && $score != "" && $team2 != "" && ([string toupper $text] == [string toupper $team1] || [string toupper $text] == [string toupper $team2])} {
putserv "PRIVMSG $chan :\00303$time \00314$team1 \00312$score \00314$team2\003"
return 0
}
}
putserv "PRIVMSG $chan :\00314Nothing found for team \00312$text\003"
return 0
}