All pastes #414380 Raw Edit

TCL News script

public text v1 · immutable
#414380 ·published 2007-03-29 00:28 UTC
rendered paste body
proc pub:news {nick uhost hand chan text} {
        putserv "PRIVMSG $chan :Fetching current news from NintendoXG.com"
	## get the url and cleanup our token
	set data [::http::data [set tok [::http::geturl "http://site.nintendoxg.com/"]]]; ::http::cleanup $tok
	## get our news items from the html
        foreach {x id title} [regexp -all -inline -- {<a href\=\'news\.php\?mode\=article\&id\=(.+?)\'>(.+?)</a>} $data] {
            ## show the info to irc...all we got from the regex was the id...so let's fill in the rest of the link
            puthelp "PRIVMSG $chan :$title \< http://site.nintendoxg.com/news.php\?mode=article\&id=$id \>"
        }
	## that's it...we are done
}
bind pub - @news pub:news