Only it announce everything to 2times., One good and one include the regexp lines.
What i'm doing wrong? (trying to get data and announce that as list to chan)
And the bind time is also not working, how can i fix that?
Can anyone help or give me some advice. Thx
Code: Select all
# -----------------------------------
# This week games from gameinformer.com
# -----------------------------------
bind pub - !newgames gameinformerprocp
bind pub - !thisweek gameinformerprocp
bind time - "00 00 * * *" gameinformerprocp
package require http
package require tls
proc gameinformerprocp {nick host hand chan txt} {
::http::register https 443 [list ::tls::socket -servername gameinformer.com]
# Get page data
set url "https://www.gameinformer.com/this-week"
set token [::http::geturl $url -timeout 1000]
set page [::http::data $token]
upvar 0 $token state
if {$state(status) ne "ok"} {
putserv "PRIVMSG $chan :\00303GAMEINFORMER:\003 $state(url) made $state(status) error"
return
}
::http::cleanup $token
::http::unregister https
# REGEXP page
set regex_title {hreflang="en">(.*?)</a>}
set titles [regexp -all -line -inline $regex_title $page]
set regex_platform {class="field__item">(.+?)<\/div>}
set platforms [regexp -all -line $regex_platform $page]
set regex_date {class="datetime">(.*?)</time>}
set dates [regexp -all -line $regex_date $page]
# Change date lay-out
set date [clock format [clock scan $dates] -format {%d-%m-%Y}]
# Announce to Chan
putserv "PRIVMSG $chan :\00303GAMES:\003 This week's Game releases:"
foreach (date $dates regex_title $titles regex_platform $platforms) {
putserv "PRIVMSG $chan :$date $regex_title (Rating: n/a) - Platform: $regex_platform"
}
}