Mercurial > hg > egg-tcls
changeset 657:f46c152183a2
fetch_feeds: Use generic HTTP request handling code also for RSS feed fetches.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 19 Feb 2021 19:30:53 +0200 |
parents | 7192d94f8c28 |
children | 33580ee2579e |
files | fetch_feeds.tcl |
diffstat | 1 files changed, 3 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/fetch_feeds.tcl Fri Feb 19 19:30:30 2021 +0200 +++ b/fetch_feeds.tcl Fri Feb 19 19:30:53 2021 +0200 @@ -124,6 +124,7 @@ proc add_entry {uname uprefix uurl utitle} { global currclock feeds_db nitems + set utmp [utl_convert_html_ent $uurl] if {[string match "http://*" $utmp] || [string match "https://*" $utmp]} { set utest "$utmp" @@ -149,12 +150,9 @@ proc add_rss_feed {datauri dataname dataprefix} { - if {[catch {set utoken [::http::geturl $datauri -binary 1 -timeout 6000 -headers {Accept-Encoding identity}]} uerrmsg]} { - puts "Error getting $datauri: $uerrmsg" - return 1 + if {![fetch_dorequest $datauri ustatus uscode ucode upage umeta]} { + return 0 } - set upage [::http::data $utoken] - ::http::cleanup $utoken set umatches [regexp -all -nocase -inline -- "<item>.\*\?<title><..CDATA.(.\*\?)\\\]\\\]></title>.\*\?<link>(http.\*\?)</link>.\*\?</item>" $upage] set nmatches [llength $umatches]