-"""
- Parser for Netscape Navigator's and Mozilla's bookmarks.html
+"""Parser for Netscape Navigator's and Mozilla's bookmarks.html
- Written by BroytMann. Copyright (C) 1997-2007 PhiloSoft Design
+This file is a part of Bookmarks database and Internet robot.
"""
+__version__ = "$Revision$"[11:-2]
+__revision__ = "$Id$"[5:-2]
+__date__ = "$Date$"[7:-2]
+__author__ = "Oleg Broytman <phd@phdru.name>"
+__copyright__ = "Copyright (C) 1997-2011 PhiloSoft Design"
+__license__ = "GNU GPL"
import sys, os
from m_lib.net.www.html import HTMLParser
def handle_data(self, data):
if data:
if DEFAULT_CHARSET:
- data = unicode(data, self.charset, "replace").encode(DEFAULT_CHARSET, "replace")
+ data = unicode(data, self.charset, "replace").encode(DEFAULT_CHARSET, "xmlcharrefreplace")
self.accumulator += data
# Start a bookmark
def start_a(self, attrs):
+ add_date = None
last_visit = None
last_modified = None
keyword = None
+ icon = None
+ charset = None
for attrname, value in attrs:
value = value.strip()
last_modified = value
elif attrname == "shortcuturl":
keyword = value
+ elif attrname == "icon":
+ icon = value
+ elif attrname == "last_charset":
+ charset = value
debug("Bookmark points to: `%s'" % href)
- bookmark = Bookmark(href, add_date, last_visit, last_modified, keyword or '')
+ bookmark = Bookmark(href, add_date, last_visit, last_modified,
+ keyword or '', '', icon, charset)
self.current_object = bookmark
self.current_folder.append(bookmark)
self.urls += 1