From: Oleg Broytman Date: Sat, 18 Nov 2023 16:47:22 +0000 (+0300) Subject: Fix(robots): Store charset X-Git-Tag: 5.0.0~18 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=15632047d4fb59cc40ef98dcb4a94438ba16f9d4;p=bookmarks_db.git Fix(robots): Store charset --- diff --git a/Robots/bkmk_rforking.py b/Robots/bkmk_rforking.py index 117bf31..7b458df 100644 --- a/Robots/bkmk_rforking.py +++ b/Robots/bkmk_rforking.py @@ -86,7 +86,7 @@ class robot_forking(Robot): "error", "no_error", "moved", "size", "md5", "real_title", "last_tested", "last_modified", "test_time", - "icon", "icon_href", + "icon", "icon_href", "charset", ): if hasattr(new_b, attr): setattr(bookmark, attr, getattr(new_b, attr)) diff --git a/Robots/bkmk_robot_base.py b/Robots/bkmk_robot_base.py index 52d6b56..ad0f6d2 100644 --- a/Robots/bkmk_robot_base.py +++ b/Robots/bkmk_robot_base.py @@ -152,6 +152,10 @@ class robot_base(Robot): content_stripped = content.strip() if content_stripped and is_html: parser = parse_html(content_stripped, charset, self.log) + if charset: + bookmark.charset = charset + elif parser and parser.meta_charset: + bookmark.charset = parser.meta_charset if parser: bookmark.real_title = parser.title icon = parser.icon diff --git a/check_url.py b/check_url.py index 697d677..1c51481 100755 --- a/check_url.py +++ b/check_url.py @@ -59,10 +59,11 @@ def run(): LastModified: %s IconURI: %s Icon: %s + Charset: %s """ % ( bookmark.href, getattr(bookmark, 'real_title', ''), strftime(bookmark.last_modified), bookmark.icon_href, - bookmark.icon)) + bookmark.icon, bookmark.charset)) robot.stop() log.close()