]> git.phdru.name Git - bookmarks_db.git/commitdiff
Fix(robots): Store charset
authorOleg Broytman <phd@phdru.name>
Sat, 18 Nov 2023 16:47:22 +0000 (19:47 +0300)
committerOleg Broytman <phd@phdru.name>
Sat, 18 Nov 2023 16:47:22 +0000 (19:47 +0300)
Robots/bkmk_rforking.py
Robots/bkmk_robot_base.py
check_url.py

index 117bf31913fba0b866217980ed58d85a04d56b97..7b458df0ca8767cba61c3c1b76a3d8d5579b03f3 100644 (file)
@@ -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))
index 52d6b563f1056c9ffe29a08299d59084d248be4e..ad0f6d209c018a2ffeb11fefa03d36e905c589f7 100644 (file)
@@ -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
index 697d6775d04f4abdd48abc039e38faa37e533959..1c51481a17254b92757ba1e59ab498079218d883 100755 (executable)
@@ -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()