From c79561dfd3ff2e2a69b542211bfb7c692210776d Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Sun, 2 Jan 2011 23:56:53 +0000 Subject: [PATCH] Get favicon before HTML redirect (refresh). git-svn-id: file:///home/phd/archive/SVN/bookmarks_db/trunk@303 fdd5c36f-1aea-0310-aeeb-c58d7e2b6c23 --- Robots/bkmk_rsimple.py | 34 ++++++++++++++++------------------ doc/ANNOUNCE | 7 ++++++- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/Robots/bkmk_rsimple.py b/Robots/bkmk_rsimple.py index 63f9602..41fa2b3 100644 --- a/Robots/bkmk_rsimple.py +++ b/Robots/bkmk_rsimple.py @@ -176,24 +176,6 @@ class robot_simple(Robot): parser = parse_html(fname, charset, self.log) if parser: bookmark.real_title = parser.title - if parser.refresh: - refresh = parser.refresh - try: - url = refresh.split('=', 1)[1] - except IndexError: - url = "self" - try: - timeout = float(refresh.split(';')[0]) - except (IndexError, ValueError): - raise RedirectException("html", "Bad redirect to %s (%s)" % (url, refresh)) - else: - try: - timeout = int(refresh.split(';')[0]) - except ValueError: - pass # float timeout - raise RedirectException("html", "%s (%s sec)" % (url, timeout)) - - # Get favicon.ico icon = parser.icon else: icon = None @@ -241,6 +223,22 @@ class robot_simple(Robot): else: self.log(" no icon : bad content type '%s'" % content_type) icons[icon] = None + if parser and parser.refresh: + refresh = parser.refresh + try: + url = refresh.split('=', 1)[1] + except IndexError: + url = "self" + try: + timeout = float(refresh.split(';')[0]) + except (IndexError, ValueError): + raise RedirectException("html", "Bad redirect to %s (%s)" % (url, refresh)) + else: + try: + timeout = int(refresh.split(';')[0]) + except ValueError: + pass # float timeout + raise RedirectException("html", "%s (%s sec)" % (url, timeout)) except KeyError, key: self.log(" no header: %s" % key) diff --git a/doc/ANNOUNCE b/doc/ANNOUNCE index 8cb06eb..15efd76 100644 --- a/doc/ANNOUNCE +++ b/doc/ANNOUNCE @@ -5,11 +5,16 @@ WHAT IS IT A set of classes, libraries, programs and plugins I use to manipulate my bookmarks.html. +WHAT'S NEW in version 4.3.1 (2011-??-??). + +Get favicon before HTML redirect (refresh). + + WHAT'S NEW in version 4.3.0 (2011-01-01). Robots no longer have one global temporary file - there are at least two (html and favicon), and in the future there will be more for -asynchronous robot(s) that would test many URLs in parallel. +asynchronous robot(s) that will test many URLs in parallel. WHERE TO GET -- 2.39.2