Пример кода страницы:
<td height="18">Играем:
<span class="white"><b>Командами</b></span><span class="Text4" ID="spanMaxTeamPlayers"> (<span class="gold">ограничение 8 человек</span>)</span>
</td>
</tr>
<tr>
<td height="18">Последовательность прохождения:
<span class="white">Линейная</span>
</td>
</tr>
<tr>
<td height="18">
Авторы игры:
<a ID="lnkAuthor" target="_blank" href="/UserDetails.aspx?uid=72139">strangeman</a>, <a ID="lnkAuthor" target="_blank" href="/UserDetails.aspx?uid=84952">Ultramarin</a>, <a ID="lnkAuthor" target="_blank" href="/UserDetails.aspx?uid=119518">Avangebit</a>
</td>
</tr>
<tr>
<td height="18">Начало игры:
<span class="white">25.09.2010 21:00:00 (<a target="_blank" href="/HowTo.aspx?about=UTC" onclick="return i15053347461.ShowDialog();">UTC</a><script type="text/javascript">//<![CDATA[
var i15053347461 = new EnDialogBox({"skin":"DefaultDialogSkin","width":666,"height":300,"title":"Помощь","btnHidden":"hddni15053347461","buttons":["dlgBtnOK"],"ajaxUrl":"/ALoader/Help.aspx?about=UTC"});
//]]></script> +11)</span>
</td>
</tr>
<tr id="ActiveGamesRepeater_ctl00_gameInfo_enContPanel_YourTimeArea">
<td height="18">Начало игры в вашей временной зоне:
<span class="white"><span id="ActiveGamesRepeater_ctl00_gameInfo_enContPanel_lblYourTime"></span> (<a target="_blank" href="/HowTo.aspx?about=UTC" onclick="return i12507472301.ShowDialog();">UTC</a><script type="text/javascript">//<![CDATA[
var i12507472301 = new EnDialogBox({"skin":"DefaultDialogSkin","width":666,"height":300,"title":"Помощь","btnHidden":"hddni12507472301","buttons":["dlgBtnOK"],"ajaxUrl":"/ALoader/Help.aspx?about=UTC"});
//]]></script> <span id="ActiveGamesRepeater_ctl00_gameInfo_enContPanel_lblUTCOffset"></span>)</span>
</td>
</tr>
<tr>
<td height="18">Время окончания:
<span class="white">26.09.2010 20:00:00 (<a target="_blank" href="/HowTo.aspx?about=UTC" onclick="return i15859638701.ShowDialog();">UTC</a><script type="text/javascript">//<![CDATA[
var i15859638701 = new EnDialogBox({"skin":"DefaultDialogSkin","width":666,"height":300,"title":"Помощь","btnHidden":"hddni15859638701","buttons":["dlgBtnOK"],"ajaxUrl":"/ALoader/Help.aspx?about=UTC"});
//]]></script> +11)</span>
</td>
</tr>
<tr>
<td height="18">Подтверждения принимаются до:
<span class="white">25.09.2010 19:00:00 (<a target="_blank" href="/HowTo.aspx?about=UTC" onclick="return i16530071981.ShowDialog();">UTC</a><script type="text/javascript">//<![CDATA[
var i16530071981 = new EnDialogBox({"skin":"DefaultDialogSkin","width":666,"height":300,"title":"Помощь","btnHidden":"hddni16530071981","buttons":["dlgBtnOK"],"ajaxUrl":"/ALoader/Help.aspx?about=UTC"});
//]]></script> +11)</span>
</td>
</tr>
В принципе движка проекта единая, так что должно парсить любую главную страницу.
как выглядит начало, но на работает:
bind pub - !en pub_encounterstat
bind msg - !en pub_encounterstat
proc pub_encounterstat {nick uhost hand chan args} {
set url "http://komsa.en.cx/Default.aspx"
set id [::egglib::http_init "pub_encounterstat_"]
::egglib::http_get $id $url [list $nick $uhost $chan]
}
proc pub_encounterstat_on_error {id nick uhost chan site} {
::egglib::out $nick $chan "\0032Немогу соедениться с http://komsa.en.cx/.. -.-\003"
}
proc pub_encounterstat_on_data {id data nick uhost chan } {
putlog "1"
foreach line [split $data \n] {
if {[ regexp -nocase -- {<a\ href=./GameDetails.aspx.*? id=.*? class=.*?>(.*?)</a>} $line garb nextgame] } { set nextgame [string trim $nextgame] }
if {[ regexp -nocase -- {<td\ height=.*?>Играем.<span\ class=.*?><b>(.*?)</b></span></td> } $line garb gametype]} {
::egglib::writedata "scripts/debug.html" [list $nextgame $gametype]
putlog "2"
putchan $chan "Предстоящая игры: $nextgame $gametype "
break
}
}
}
bind msg - !en pub_encounterstat
proc pub_encounterstat {nick uhost hand chan args} {
set url "http://komsa.en.cx/Default.aspx"
set id [::egglib::http_init "pub_encounterstat_"]
::egglib::http_get $id $url [list $nick $uhost $chan]
}
proc pub_encounterstat_on_error {id nick uhost chan site} {
::egglib::out $nick $chan "\0032Немогу соедениться с http://komsa.en.cx/.. -.-\003"
}
proc pub_encounterstat_on_data {id data nick uhost chan } {
putlog "1"
foreach line [split $data \n] {
if {[ regexp -nocase -- {<a\ href=./GameDetails.aspx.*? id=.*? class=.*?>(.*?)</a>} $line garb nextgame] } { set nextgame [string trim $nextgame] }
if {[ regexp -nocase -- {<td\ height=.*?>Играем.<span\ class=.*?><b>(.*?)</b></span></td> } $line garb gametype]} {
::egglib::writedata "scripts/debug.html" [list $nextgame $gametype]
putlog "2"
putchan $chan "Предстоящая игры: $nextgame $gametype "
break
}
}
}
Подскажите, помогите довести скрипт до ума.