]> git.phdru.name Git - bookmarks_db.git/commitdiff
Fix(bkmk_ph_beautifulsoup4): Ignore all XML-related warnings
authorOleg Broytman <phd@phdru.name>
Tue, 25 Feb 2025 17:51:26 +0000 (20:51 +0300)
committerOleg Broytman <phd@phdru.name>
Tue, 25 Feb 2025 17:51:26 +0000 (20:51 +0300)
parse_html/bkmk_ph_beautifulsoup4.py

index 148a6f7166a03b7f8e990ca53b04906e749412bf..47c313091399880971577c5c56138100cf769824 100644 (file)
@@ -5,7 +5,7 @@ This file is a part of Bookmarks database and Internet robot.
 """
 
 __author__ = "Oleg Broytman <phd@phdru.name>"
-__copyright__ = "Copyright (C) 2017-2024 PhiloSoft Design"
+__copyright__ = "Copyright (C) 2017-2025 PhiloSoft Design"
 __license__ = "GNU GPL"
 
 __all__ = ['parse_html']
@@ -14,14 +14,12 @@ __all__ = ['parse_html']
 import warnings
 
 from bs4 import BeautifulSoup
+from bs4 import XMLParsedAsHTMLWarning
 
 from .bkmk_ph_util import HTMLParser
 
-warnings.filterwarnings(
-    'ignore', 'No parser was explicitly specified')
-warnings.filterwarnings(
-    'ignore',
-    "It looks like you're parsing an XML document using an HTML parser.")
+warnings.filterwarnings('ignore', 'No parser was explicitly specified')
+warnings.filterwarnings("ignore", category=XMLParsedAsHTMLWarning)
 
 universal_charset = "utf-8"
 DEFAULT_CHARSET = "cp1251"  # Stupid default for Russian Cyrillic