Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bind pub - !тест parsing
- proc parsing {nick uhost hand chan text} {
- ::http::config -useragent "Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; PPC; 240x320)"
- set parsing_tok [::http::geturl "http://m.gismeteo.ru/weather/4392/current/" -timeout 20000]
- set data [regsub -all -- {\n|\r|\t|\v} [::http::data $parsing_tok] ""]
- ::http::cleanup $parsing_tok
- if {[regexp -nocase -- {<div class="menu__item bold">(.*?)</div>} $data -> region]} {
- regsub -all -- {<.*?>} $region {} region
- regsub -all -- { /} $region {} region
- set strana [lindex $region 0]
- set gorod [lindex $region 1]
- regexp -nocase -- {<div class="title">(.*?)</div>} $data -> sdata
- regexp -nocase -- {<td class="weather__temp"><span>(.*?)</span></td>} $data -> temp
- putserv "PRIVMSG $chan : Страна: $strana; Город: $gorod Прогноз погоды на: $sdata; Температура воздуха: $temp"
- } {putserv "NOTICE $nick :Ошибка парсинга."}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement