]> git.phdru.name Git - bookmarks_db.git/commitdiff
Fix(bkmk_ph_lxml): Catch `ParserError`
authorOleg Broytman <phd@phdru.name>
Sun, 11 Aug 2024 18:24:52 +0000 (21:24 +0300)
committerOleg Broytman <phd@phdru.name>
Thu, 15 Aug 2024 17:45:00 +0000 (20:45 +0300)
parse_html/bkmk_ph_lxml.py

index 7af98e7facec38d987f8add8b55ca281bf28a57a..eb8ecc63215f3a857877735a942e9fcea569f8dc 100644 (file)
@@ -12,6 +12,7 @@ __all__ = ['parse_html']
 
 
 import re
+from lxml.etree import ParserError
 from lxml.html import fromstring
 from .bkmk_ph_util import HTMLParser
 
@@ -39,6 +40,8 @@ def parse_html(html_text, charset=None, log=None):
                 return None
         else:
             raise
+    except ParserError:
+        return None
 
     title = html_tree.findtext('head/title')
     if title is None: