From d655a6006176ecd02b8bbf6fe942a8f518f30e13 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Wed, 3 Oct 2007 14:09:50 +0000 Subject: [PATCH] Get icon's URL. git-svn-id: file:///home/phd/archive/SVN/bookmarks_db/trunk@76 fdd5c36f-1aea-0310-aeeb-c58d7e2b6c23 --- Robots/bkmk_rsimple.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/Robots/bkmk_rsimple.py b/Robots/bkmk_rsimple.py index 77ed46f..c34a127 100644 --- a/Robots/bkmk_rsimple.py +++ b/Robots/bkmk_rsimple.py @@ -1,10 +1,17 @@ """ - Simple, strightforward robot; guaranteed to has problems with timeouts :) + Simple, strightforward robot - Written by BroytMann, Mar 2000 - Sep 2007. Copyright (C) 2000-2007 PhiloSoft Design + Written by Oleg BroytMann. Copyright (C) 2000-2007 PhiloSoft Design. """ +import string, os +import time, urllib +from urlparse import urljoin +from m_lib.net.www.util import parse_time +from m_lib.md5wrapper import md5wrapper + + class RedirectException(Exception): reloc_dict = { 301: "perm.", @@ -15,12 +22,6 @@ class RedirectException(Exception): Exception.__init__(self, "(%s) to %s" % (self.reloc_dict[errcode], newurl)) -import string, os -import time, urllib -from m_lib.net.www.util import parse_time -from m_lib.md5wrapper import md5wrapper - - class MyURLopener(urllib.URLopener): # Error 302 -- relocated (temporarily) def http_error_302(self, url, fp, errcode, errmsg, headers, data=None): @@ -157,6 +158,11 @@ class robot_simple(Robot): raise RedirectException("html", "Bad redirect to %s (%s)" % (url, refresh)) else: raise RedirectException("html", "%s (%d sec)" % (url, timeout)) + icon = parser.icon + if not icon: + icon = "/favicon.ico" + icon = urljoin("%s://%s" % (url_type, url_host), icon) + if self.log: self.log(" icon : %s" % icon) except KeyError: pass -- 2.39.5