Respond to command !blog and have a timer who MSG to #chan every 30 min a link from http://IRCStar.Org Blog
» 17:56:40pm « »@`Dorin« !blog
» 17:56:45pm « »@UnixCrew« » wWw.IRCStar.Org « News: Si femeile de varsta a 2 a stiu sa se distreze Comments: 5 Link: http://ircstar.org/?p=860
### IRCStar.Org Blog News script. v1.0
### Created By Dorin !
### Make sure you load the http.tcl file
### Settings ########################
set hh(channel) "#Your_Channel" ;#
set hh(timeout) "600000" ;#
set hh(results) "50" ;#
#####################################
bind pub -|- !blog ircstar:blog
proc ircstar:blog {nick host hand chan arg} {
ircstar:news 1 2 3 4 5
}
bind time - "00 * * * *" ircstar:news
bind time - "30 * * * *" ircstar:news
proc ircstar:news {min hour day month year} {
global hh
#######################
http::config -useragent "Mozilla/5.0 (Windows; U; Windows NT 5.1; en US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1"
set tok [http::geturl http://ircstar.org/?paged=1 -timeout $::hh(timeout)]
set data [http::data $tok]
set tok [http::geturl http://ircstar.org/?paged=2 -timeout $::hh(timeout)]
set data "$data [http::data $tok]"
set tok [http::geturl http://ircstar.org/?paged=3 -timeout $::hh(timeout)]
set data "$data [http::data $tok]"
set tok [http::geturl http://ircstar.org/?paged=4 -timeout $::hh(timeout)]
set data "$data [http::data $tok]"
set tok [http::geturl http://ircstar.org/?paged=5 -timeout $::hh(timeout)]
set data "$data [http::data $tok]"
http::cleanup $tok
regsub -nocase -all (<b>|</b>|\t|\n) $data "" data
set a "0"
set b [rand 50]
if {$b == "0"} { incr b }
while {[regexp -- {<div class="cmt"><a href="(.+?)" title="Comment on (.+?)">(.+?)</a></div>(.*)$} $data -> link news coments data]} {
if {$a == $::hh(results)} { break }
set news [string map {
"\u8a" "S" "\u8e" "Z" "\u9a" "s" "\u9e" "Z" "\u9f" "Y"
"\uaa" "a" "\ub2" "2" "\ub3" "3" "\ub5" "u" "\ubf" "?"
"\uc0" "A" "\uc1" "A" "\uc2" "A" "\uc3" "A" "\uc4" "A"
"\uc5" "A" "\uc6" "AE" "\uc7" "C" "\uc8" "E" "\uc9" "E"
"\uca" "E" "\ucb" "E" "\ucc" "I" "\ucd" "I" "\uce" "I"
"\ucf" "I" "\ud0" "D" "\ud1" "N" "\ud2" "O" "\ud3" "O"
"\ud4" "O" "\ud5" "O" "\ud6" "O" "\ud7" "x" "\ud8" "O"
"\ud9" "U" "\uda" "U" "\udb" "U" "\udc" "U" "\udd" "Y"
"\udf" "s" "\ue0" "a" "\ue1" "a" "\ue2" "a" "\ue3" "a"
"\ue4" "a" "\ue5" "a" "\ue6" "ae" "\ue7" "C" "\ue8" "e"
"\ue9" "e" "\uea" "e" "\ueb" "e" "\uec" "i" "\ued" "i"
"\uee" "i" "\uef" "i" "\uf1" "n" "\uf2" "o" "\uf3" "o"
"\uf4" "o" "\uf5" "o" "\uf6" "o" "\uf9" "u" "\ufa" "u"
"\ufb" "u" "\ufc" "u" "\ufd" "y" "\ufe" "b" "\uff" "y"
"\u100" "A" "\u101" "a" "\u102" "A" "\u103" "a" "\u104" "A"
"\u105" "a" "\u106" "C" "\u107" "c" "\u108" "C" "\u109" "c"
"\u10a" "C" "\u10b" "c" "\u10c" "C" "\u10d" "c" "\u10e" "D"
"\u10f" "d" "\u110" "D" "\u111" "d" "\u112" "E" "\u113" "e"
"\u114" "E" "\u115" "e" "\u116" "E" "\u117" "e" "\u118" "E"
"\u119" "e" "\u11a" "E" "\u11b" "e" "\u11c" "G" "\u11d" "g"
"\u11e" "G" "\u11f" "g" "\u120" "G" "\u121" "g" "\u122" "G"
"\u123" "g" "\u124" "H" "\u125" "h" "\u126" "H" "\u127" "h"
"\u128" "I" "\u129" "i" "\u12a" "I" "\u12b" "i" "\u12c" "I"
"\u12d" "i" "\u12e" "I" "\u12f" "i" "\u130" "I" "\u132" "IJ"
"\u133" "ij" "\u134" "j" "\u135" "J" "\u136" "K" "\u137" "k"
"\u138" "K" "\u139" "L" "\u13a" "l" "\u13b" "L" "\u13c" "l"
"\u13d" "L" "\u13e" "l" "\u13f" "L" "\u140" "l" "\u141" "L"
"\u142" "l" "\u143" "N" "\u144" "n" "\u145" "N" "\u146" "n"
"\u147" "N" "\u148" "n" "\u149" "n" "\u14a" "N" "\u14b" "n"
"\u14c" "O" "\u14d" "o" "\u14e" "O" "\u14f" "o" "\u150" "O"
"\u151" "o" "\u152" "CE" "\u153" "ce" "\u154" "R" "\u155" "r"
"\u156" "R" "\u157" "r" "\u158" "R" "\u159" "r" "\u15a" "S"
"\u15b" "s" "\u15c" "S" "\u15d" "s" "\u15e" "S" "\u15f" "s"
"\u160" "S" "\u161" "s" "\u162" "T" "\u163" "t" "\u164" "T"
"\u165" "t" "\u166" "T" "\u167" "t" "\u168" "U" "\u169" "u"
"\u16a" "U" "\u16b" "u" "\u16c" "U" "\u16d" "u" "\u16e" "U"
"\u16f" "u" "\u170" "U" "\u171" "u" "\u172" "U" "\u173" "u"
"\u174" "W" "\u175" "w" "\u176" "Y" "\u177" "y" "\u178" "Y"
"\u179" "Z" "\u17a" "z" "\u17b" "Z" "\u17c" "z" "\u17d" "Z"
"\u17e" "z" "\u17f" "f" "\u192" "f" "\u1fa" "A" "\u1fb" "a"
"\u1fc" "AE" "\u1fd" "ae" "\u1fe" "O" "\u1ff" "o"
} $news]
set link [string map { "#respond" "" "#comments" "" } $link]
incr a
if {$b == $a} { puthelp "PRIVMSG $::hh(channel) :7» 3wWw.IRCStar.Org 7« 2News14\:10 $news 2Comments14\:12 $coments 2Link14\:4 $link"
break }
}
}
####################################################################
putlog "IRCStar Blog News TcL By Dorin Loaded!"
Just curious why the giant string map. I see that you are not using the properly accented characters with your replacements.
This code will replace them correctly with all the right accents.
proc dehex {string} {
set string [subst [regsub -nocase -all {\\u([a-f0-9]{4})} $string {[format %c [decimal \1]]}]]
return $string
}
proc decimal {hex} { return [expr 0x$hex] }
proc hex {decimal} { return [format %x $decimal] }
_________________________________________________________________________________________________
To use this code , you would just put:
set news [dehex $news]
Instead of:
set news [string map ...................]