# HG changeset patch # User Matti Hamalainen # Date 1446408325 -7200 # Node ID 51c08336d7b1c8d45c1b3e782932937188b5aef0 # Parent f7793ef7c925bac9ac8d5f059e5163fe5fa3f1d1 feeds: Add support for Poliisi.fi information reports. diff -r f7793ef7c925 -r 51c08336d7b1 fetch_feeds.tcl --- a/fetch_feeds.tcl Sun Nov 01 22:04:45 2015 +0200 +++ b/fetch_feeds.tcl Sun Nov 01 22:05:25 2015 +0200 @@ -190,6 +190,23 @@ } +### Poliisi tiedotteet +proc fetch_poliisi { datauri dataname dataprefix } { + if {![fetch_dorequest $datauri ustatus uscode ucode upage umeta]} { + return 0 + } + + set umatches [regexp -all -nocase -inline -- "
(.*?)
(\[^<\]+)" $upage] + set nmatches [llength $umatches] + for {set n 0} {$n < $nmatches} {incr n 4} { + set stmp [string trim [lindex $umatches [expr $n+3]]] + add_entry $dataname $dataprefix [lindex $umatches [expr $n+2]] "[lindex $umatches [expr $n+1]]: $stmp" + } +} + + + + ### Open database, etc set nitems 0 set currclock [clock seconds] @@ -201,6 +218,8 @@ ### Fetch the feeds +fetch_poliisi "http://www.poliisi.fi/oulu/tiedotteet/1/0?all1/0" "Poliisi/Oulu" "http://www.poliisi.fi" + fetch_halla_aho fetch_adventurers